Address of an array

When t is used on its own in the expression, an array-to-pointer conversion takes place, this produces a pointer to the first element of the array. When t is used as the argument of the & operator, no such conversion takes place. The & then explicitly takes the address of t (the array). &t is … Read more

Memory address of variables in Java

That is the class name and System.identityHashCode() separated by the ‘@’ character. What the identity hash code represents is implementation-specific. It often is the initial memory address of the object, but the object can be moved in memory by the VM over time. So (briefly) you can’t rely on it being anything. Getting the memory … Read more

Correct format specifier to print pointer or address?

The simplest answer, assuming you don’t mind the vagaries and variations in format between different platforms, is the standard %p notation. The C99 standard (ISO/IEC 9899:1999) says in §7.19.6.1 ¶8: p The argument shall be a pointer to void. The value of the pointer is converted to a sequence of printing characters, in an implementation-defined … Read more