Question
1.
#include
2.
using namespace std;
3.
void fun(int x, int y)
4.
{
5.
x = 20;
6.
y = 10;
7.
}
8.
int main()
9.
{
10.
int x = 10;
11.
fun(x, x);
12.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
void fun(int x, int y)
4.
{
5.
x = 20;
6.
y = 10;
7.
}
8.
int main()
9.
{
10.
int x = 10;
11.
fun(x, x);
12.
cout
Answer: Option A
Was this answer helpful ?
In this program, we called by value so the value will not be changed, So the output is 10
Output:
$ g++ fun.cpp
$ a.out
10
Was this answer helpful ?
Submit Solution