Use "%p" instead of "%u" for printing pointers

You should use “%p” (*), instead of “%u”. The main advantage is then you don’t need to care if your platform uses 64 or 32-bits pointers.
And It also make the code more explicit: “I’m printing a pointer, not some random unsigned integer”.

(*) this is not part of the C/C++ standard, but it should work on all modern platforms

2 Likes

Privacy & Terms