Output address of variable without printf %p
<p>I am a first year student in C programming so my skill/knowledge is limited. I am trying to create my own implementation on <code>printf</code>,  but I am having trouble with retrieving and printing the address of a variable. With <code>printf</code>, its possible to output the address of a variable with <code>%p</code>,  i need to replicate <code>%p</code> somehow.</p>
<p>When storing the address of a variable, the data type is <code>int*</code>, and I cannot figure out how to write this address to the screen(stdout).</p>
<h2>For Example:</h2>
<pre><code>int i        = 123;
int *address = &amp;i;
</code></pre>
<p>Now how would I output <code>address</code>(not the value at <code>i</code>)?  I have tried using the original <code>printf</code> format specifiers for testing purposes. I tried using %x, %s, %d, %lu... it all gives me an error as I am trying to output an <code>int*</code>(integer pointer).</p>
<p>Can anyone assist me in outputting the address?</p>