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

Consider the following (erroneous) program in C: Please answer each part with

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!