here is my code
#include<iostream>
using namespace std;
int *f1(int x) {
return &x;
}
void f2(int a, int b, int c){
cout<<a<<endl;
}
int main() {
cout<<"hari Hari"<<endl;
int *x;
x = f1(90);
f2(3,45,2);
cout<<*x<<endl;
system("PAUSE");
}
now as f1 return pointer to stack, which was suppose to overwritten by f2, and expected output should be looks something like this " hari Hari 3 3 " but actually I get right answer, and my actual output is, " hari Hari 3 90 " I can't understand why it is not overwrite the value of f1 function's 'x'.