C++ output type question

Q.  Trace the output.

#include< iostream.h>
# define SQUARE(x) x*x
inline float square(float y)
{

return y*y;

}
int main( )

{

float a = 0.5, b = 0.5, c, d;
c = SQUARE(++a);
d = square(++b);
cout << c << endl << d;
return 0;

}

- Published on 17 Jun 15

a. 6.25, 2.25
b. 2.25, 2.25
c. Compile time error.
d. None of the above.

ANSWER: 6.25, 2.25

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)