A 64-bit value is 64 bits (8 bytes). An int
(which is what the format specifier "%d"
uses) is 32 bits (4 bytes).
So what printf
does in the crashing line is to read 4 bytes to print as an integer, then it will read the remaining four bytes (on a 32-bit system) or the remaining four bytes and the first four bytes of the string pointer (on a 64-bit system) to use as the string pointer. That string pointer is, as you can understand, not a valid pointer, and so you have undefined behavior which in your case leads to a crash.