Question
1.
#include
2.
using namespace std;
3.
void duplicate (int& a, int& b, int& c)
4.
{
5.
a *= 2;
6.
b *= 2;
7.
c *= 2;
8.
}
9.
int main ()
10.
{
11.
int x = 1, y = 3, z = 7;
12.
duplicate (x, y, z);
13.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
void duplicate (int& a, int& b, int& c)
4.
{
5.
a *= 2;
6.
b *= 2;
7.
c *= 2;
8.
}
9.
int main ()
10.
{
11.
int x = 1, y = 3, z = 7;
12.
duplicate (x, y, z);
13.
cout
Answer: Option C
Was this answer helpful ?
:We are passing the values by reference and modified the data on the function block.
Output:
$ g++ call1.cpp
$ a.out
2614
Was this answer helpful ?
Submit Solution