1.

How Do You Print An Address?

Answer»

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 (“%PN”, (void*) buffer);

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*:



Discussion

No Comment Found