I have two small functions called from main. Below is the program
int fun1(int x)
{
int s;
s=8;
}
int fun2(int x)
{
int s;
s=x*4;
}
int main(int argc, char *argv[])
{
int n=2;
cout << fun1(n)<<endl;
cout<<fun2(n)<<endl;
return 0;
}
1.fun1() function called with arguement x but no operation done using x variable. So in the output "cout<< fun1()-- I am getting output 2 "present value of n".
2.fun2() function called with arguement x and used it in operation "s=x*4" and in the output "cout<< fun2()"-- I am getting output 8--"2*4".
I am not passing any reference or pointer value to the function still getting two different outputs. Would like to know how the stack unwinding is different in the two different function cases.