[NSWI004] printf %p

Vojtech Horky horky at d3s.mff.cuni.cz
Tue Sep 29 15:13:01 CEST 2020


Hello.

Dne 29. 09. 20 v 15:06 Georgii Ekserdzhian napsal(a):
> I have a question about printf and %p specifier. I couldn't find any 
> info on this.
> Why is it printing only 6 lowest bytes of the address? Aren't pointers 
> supposed to be 8 bytes(at least on 64 bit machine)?

Because by default it does not print leading zeros. Please, see the 
output of:

printf("main = %p %018p\n", &main, &main);

- VH


More information about the NSWI004 mailing list