Question
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
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
Answer: Option D
Was this answer helpful ?
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 ?
More Questions on This Topic :
Question 3.
By default how the value are passed in c++?
....
Submit Solution