I have some trouble with a book that I am currently reading about C and assembly. The author uses a 32 bit environment while I am using 64-bit. The problem is that the author often uses
printf("%08x", &var);
To print addresses which works fine on 32 bit. But when I run this on 64-bit I get only half of the address while %p
gives me the whole address... So why is this so? I of course use %016x
instead of %08x
.
The author only uses %p
for pointers.
So when should I use what?