-
What is the new value of P?
#include
using namespace std;
void function(int &p)
{
p = 15;
}
int main()
{
int p = 12;
function(p);
cout << "New value of P is " << p;
return 0;
}
-
- New value of P is 12
- Compilation Error
- New value of P is 15
- Runtime Error
- None of these
Correct Option: C
As we passed by reference, the value is changed and it is returned as 15.