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
uintptr_t is an unsigned integer type that is capable of storing a data pointer (whether it can hold a function pointer is unspecified). Which typically means that it's the same size as a pointer.
"printf" is the name of one of the main C output functions, and stands for "print formatted". printf format strings are complementary to scanf format strings, which provide formatted input (lexing aka. parsing).
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With