What is the string format for intptr_t
and uintptr_t
which is valid for both the 32 and 64 bit architecture .
EDIT
warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type "AAA"
This is the warning i am getting in 64 bit but not in 32 bit.
intptr_t AAA
That would be the following macros from inttypes.h
:
For printf
:
PRIdPTR PRIiPTR PRIoPTR PRIuPTR PRIxPTR PRIXPTR
For scanf
:
SCNdPTR SCNiPTR SCNoPTR SCNuPTR SCNxPTR
Usage example:
uintptr_t p = SOME_VALUE;
printf("Here's a pointer for you: %" PRIxPTR "\n", p);