Code:#include <stdio.h> int main(void) { int *a; { int b = 5; a = &b; } return 0; }
since b goes out of scope, would a be referencing to garbage?
Code:#include <stdio.h> int main(void) { int *a; { int b = 5; a = &b; } return 0; }
since b goes out of scope, would a be referencing to garbage?
Yes, assuming the compiler doesn't optimize everything away.
Last edited by hamster_nz; 11-10-2020 at 02:23 PM.