I'm wondering if a C pointer can point to a value in an inner block and then dereference the pointer after the inner block ends?
#include <stdio.h>
int main() {
    int a = 42;
    int *r;
    {
        int b = 43;
        r = &b;
    }
    int c = 44;
    printf("%d\n", c);  // Output: 44
    // Is this OK?
    printf("%d\n", *r); // Output: 43
    return 0;
}
Am I getting the output "43" by luck or by design? Does C language specification say something about this situation? (Note that I'm not asking what a specific C compiler behaves)
 
     
     
    