Fill This Form To Receive Instant Help
Homework answers / question archive / The 3rd PPT in this unit lists this example program when explaining the issue of uninitialized variables in C/C++
The 3rd PPT in this unit lists this example program when explaining the issue of uninitialized variables in C/C++. In theory the program should return a junk value due to the uninitialized local variable a in adder(). However, it will return 42. Why is that?
int adder() {
int a;
return a + 2;
}
int assign() {
int y = 40;
return y;
}
int main() {
int x;
assign();
x = adder();
return x;
}