Question: 1 . Consider the following ( erroneous ) program in C: void p ( ) { int y; printf ( % d ,
Consider the following erroneous program in C:
void p int y; printf d y;
y ;
void main
p; p;
Although the local variable y is not initialized before being used, the program prints two values the first value typically is garbage or possibly if you are executing inside a debugger or other controlled environment but the second value might be try this on Unix!
a pts Explain this behavior. Why does the local variable y appear to retain its value from one call to the next?
b pts 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
