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?
Printable View
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.