How do you print an address? Ans. The safest way is to use printf() (or fprintf() or sprintf()) with the %P specification. That prints a void pointer (void*). Different compilers might print a pointer with different formats. Your compiler will pick a format that's right for your environment. If you have some other kind of pointer (not a void*) and you want to be very safe, cast the pointer to a void*: printf( '%P\n', (void*) buffer ); There's no guarantee any integer type is big enough to store a pointer. With most compilers, an unsigned long is big enough. The second safest way to print an address (the value of a pointer) is to cast it to an unsigned long, then print that. - Study24x7
Social learning Network
10 Apr 2023 05:37 PM study24x7 study24x7

How do you print an address? Ans. The safest way is to use printf() (or fprintf() or sprintf()) with the %P specification. That prints a void pointer (void*). Different compilers might print a pointer with different formats. Your compiler will pick a format that's right for your...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles