 <p>This is implementation defined as per the <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf" rel="nofollow">draft C99 standard</a> section <code>6.3.2.3</code> <em>Pointers</em> which says:</p> <blockquote> <p>Any pointer type may be converted to an integer type. Except as previously specified, the result is implementation-defined. If the result cannot be represented in the integer type, the behavior is undefined. The result need not be in the range of values of any integer type.</p> </blockquote> <p><code>gcc</code> documents there implementation <a href="https://gcc.gnu.org/onlinedocs/gcc/Arrays-and-pointers-implementation.html#Arrays-and-pointers-implementation" rel="nofollow">here</a>:</p> <blockquote> <p>The result of converting a pointer to an integer or vice versa (C90 6.3.4, C99 and C11 6.3.2.3).</p> <ul> <li><p>A cast from pointer to integer discards most-significant bits if the pointer representation is larger than the integer type, sign-extends1 if the pointer representation is smaller than the integer type, otherwise the bits are unchanged.</p></li> <li><p>A cast from integer to pointer discards most-significant bits if the pointer representation is smaller than the integer type, extends according to the signedness of the integer type if the pointer representation is larger than the integer type, otherwise the bits are unchanged.</p></li> </ul> </blockquote> <p>Alternatively you could use <em>uinitptr_t</em> assuming <code>stdint.h</code> is available which is an unsigned integer that can hold a pointer value:</p> <pre><code>#include &lt;stdint.h&gt; #include &lt;inttypes.h&gt; uintptr_t ip = &amp;i ; printf("0x%016" PRIxPTR "\n", ip ) ; </code></pre>