Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
void square (int *x)
4.
{
5.
*x = (*x + 1) * (*x);
6.
}
7.
int main ( )
8.
{
9.
int num = 10;
10.
square(&num);
11.
cout
Options:
A .  100
B .  compile time error
C .  144
D .  110
Answer: Option D

We have increased the x value in operand as x+1, so it will return as 110.
Output:
$ g++ arg2.cpp
$ a.out
110



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers