Question: Consider the following (erroneous) program in C: Please answer each part with full detail 2. Consider the following (erroneous) program in C: void p ()
Consider the following (erroneous) program in C: Please answer each part with full detail

2. Consider the following (erroneous) program in C: void p () int y; printf ("%d ", y); y = 2; void main ) p)i p)i Although the local variable y is not initialized before being used, the program prints two values the first value typically is garbage (or possibly 0, if you are executing inside a debugger or other controlled environment), but the second value might be 2 (try this on Unix!) (a) Explain this behavior. Why does the local variable y appear to retain its value from one call to the next? (b) Explain in what circumstances (without modifying function p) the local variable y will not retain its value between calls, and show an example
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
