Q. What is the output of the following C++ code?
Code:
#include <iostream>
using namespace std;
int sum(int x, int y);
int main()
{
int i = 1, j = 2;
cout << sum(i, j) << endl;
return 0;
}
int sum(int x, int y )
{
int s = x + y;
x = 2;
return x + y;
}
β
Correct Answer: (B)
4