ISRO | ISRO CS 2017 – May | Question 40

What is the output of this C++ program?

#include 
using namespace std;
void square (int *x)
{
*x = (*x)++ * (*x);
}
void square (int *x, int *y)
{
*x = (*x) * --(*y);
}
int main ( )
{
int number = 30;
square(&number, &number);
cout << number;
return 0;
}

(A) 910
(B) 920
(C) 870
(D) 900


Answer: (C)

Explanation:

Quiz of this Question
Please comment below if you find anything wrong in the above post




My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.