0
#include<iostream>

using namespace std;
int m=10;

int f(int z(int, int))
{
    return z(10, 10) + m;
}

int x(int a, int b)
{
    m=200;
    return a + b + m;
}

int main()
{
    cout << f(x) << endl << m;
    return 0;
}

Output:

420
10

In the above code, if the value of m is changed to 200 in the function x(), then why does is show to be 10 in the output in the main function ?

Here's the link to the code: http://ideone.com/qZIDXr

shreyans800755
  • 224
  • 1
  • 10

0 Answers0