πŸ“Š C++
Q. Output of following C++ program?
#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 = 20; ref = 30
  • (B) x = 20; ref = 20
  • (C) x = 10; ref = 30
  • (D) x = 30; ref = 30
πŸ’¬ Discuss
βœ… Correct Answer: (A) x = 20; ref = 30

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
74
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Shiva Ram
Publisher
πŸ“ˆ
90%
Success Rate