A

Admin • 833K Points
Coach

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;
}
  • (A) 3
  • (B) 4
  • (C) Compilation error
  • (D) None of these
  • Correct Answer - Option(B)
  • Views: 19
  • Filed under category C++
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.