C++ Programming - Functions - Discussion

Discussion Forum : Functions - Programs (Q.No. 1)
1.
What will be the output of the following program?
#include<iostream.h>
long BixFunction(int x, int y = 5, float z = 5)
{
    return(++x * ++y + (int)++z);
}
int main()
{
    cout<< BixFunction(20, 10); 
    return 0;
}
237
242
240
35
The program will report error on compilation.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
16 comments Page 2 of 2.

Tsaone mogotetsi said:   1 decade ago
237 is the correct answer because on the output concept there's been a new assignment to the variables which lives 'z' out therefore living us to calculate on its default assigned value and the new assigned values of x and why.

Vinay said:   1 decade ago
Why not error?

Archana said:   1 decade ago
There are two data types for variable z. How it is possible?

Can anyone explain?

Patel Ravi said:   1 decade ago
Nice programming language.

Jaideep gupta said:   10 years ago
Ya I computed in the values written in main function overwritten the values present in bix function.

Gopi said:   5 years ago
Gives error.

use #include<iostream> instead #include<iostream.h>


Post your comments here:

Your comments will be displayed after verification.