#include int* f(int x) { int *p; if (x) { int y = 3; p = &y; /* ok */ printf ("y=%d and *p=%d\n", y, *p); } /* ok, but p now dangling */ printf ("*p=%d\n", *p); /* y = 4 does not compile */ *p = 7; /* could CRASH but probably not */ printf ("*p=%d\n", *p); return p; /* uh-oh, but no crash yet */ } void g(int *p) { *p = 123; f(123); // now just to demonstrate the stack printf ("in g: *p=%d\n", *p); } int main(int argc, char **argv) { g(f(7)); /* HOPEFULLY YOU CRASH (but maybe not) */ }