C++ Programming - Functions - Discussion

Discussion Forum : Functions - General Questions (Q.No. 1)
1.
Which of the following function prototype is perfectly acceptable?
int Function(int Tmp = Show());
float Function(int Tmp = Show(int, float));
Both A and B.
float = Show(int, float) Function(Tmp);
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
19 comments Page 2 of 2.

Shahzada said:   1 decade ago
Yes option A is correct answer because in A function prototyping show function is called but in option B in prototyping of one function another prototyping is given which is not according to the syntax of function prototyping because return typing is not given.

Deepak said:   1 decade ago
Parameters are can not be write inside in any parameters.

Sree said:   1 decade ago
In the case of function prototype I think the type of the arguments are to be specified not the variable name, here return type should be specified.

Karuppusamy said:   1 decade ago
The statement in A only matches with the syntax of a function declaration.

Hemanth said:   1 decade ago
Obviously the option A is correct answer the arguments where given in the option A so it is true where as in option B there are no arguments in prototype in the side of int and float. So it is false. :-).

Sandy said:   1 decade ago
How you can say that show in A is also returning a compatiable or you can int type value. And why not in option B?

NISHU said:   1 decade ago
You can't compare the value of one function to value of the variable TEMP ;if you want to then arguments should be used exactly not with their type. i.e., Direct variable on which this function is applied.

Aman Goel said:   1 decade ago
Because if we talk about the function with argument then return type of function is very important.

Function return type tells that what type of value is function return.

Pankaj Thapa said:   1 decade ago
If a is correct then how b is incorrect it is calling a method using parameters which perfectly satisfies the syntax used for calling a method.


Post your comments here:

Your comments will be displayed after verification.