/* CSE 374 Winter 2014 Lecture 9, Slide 10 Example B (zero argument to f) */ #include int* f(int x) { int *p; if (x) { /* whether this code executes or not depends on the value of x */ /* the scope of y is only within these { } */ int y = 3; /* ok */ p = &y; } /* if x evaluated to true, then p points to the address that had represented where y was stored, otherwise who knows where it points */ /* at any case, p is dangling because y either never existed or went out of existence at } */ *p = 7; return p; } void g(int *p) { *p = 123; } /* changed function h on the slide to main */ int main() { g(f(0)); return 0; }