Which format specifier should I be using to print the address of a variable? I am confused between the below lot.
%u - unsigned integer %x
%u - unsigned integer
%x
p is the conversion specifier to print pointers. Use this.
p
int a = 42; printf("%p\n", (void *) &a);
Remember that omitting the cast is undefined behavior and that printing with p conversion specifier is done in an implementation-defined manner.