R

Ram Sharma • 193.86K Points
Coach

Q. Output of following C++ program?

Code:
#include<iostream>
using namespace std;
int main()
{
int x = 10;
int& ref = x;
ref = 20;
cout << "x = " << x << endl ;
x = 30;
cout << "ref = " << ref << endl;
return 0;
}
  • (A) x = 30; ref = 30
  • (B) x = 10; ref = 30
  • (C) x = 20; ref = 20
  • (D) x = 20; ref = 30
  • Correct Answer - Option(D)
  • Views: 104
  • Filed under category C++

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics