-
What is the output of this program?
#include <iostream>
using namespace std;
void duplicate (int& P, int& Q, int& R)
{
P *= 2;
Q *= 2;
R *= 2;
}
int main ()
{
int M = 2, N = 4, O = 6;
duplicate (M, N, O);
cout << M <<" "<< N <<" "<< O;
return 0;
}
-
- 4 8 12
- 12 8 4
- 8 12 4
- Compilation Error
- None of these
Correct Option: A
We are passing the values by reference and modified the data on the function block.