Examveda

What will be the new value of x in the following C++ code?
#include <iostream>
using namespace std;
void fun(int &x)
{
    x = 20;
}
int main()
{
     int x = 10;
     fun(x);
     cout << "New value of x is " << x;
     return 0;
}

A. 10

B. 20

C. 15

D. 36

Answer: Option B


Join The Discussion

Related Questions on Functions and Procedures in C plus plus