For example, we have the following simple code:
#include "stdio.h"
int main() {
int* pointer_to_check;
printf("%x\n", pointer_to_check);
return 0;
}
With gcc, we will get zero at output (as for me, normal behavior, because pointer isn't associated with memory), but clang gives us a real address, which can be accessed without "segmentation fault".
I have two questions:
- What is the normal behavior according to the C standard (and C++)?
- Why does this happen?