Why malloc return value is not in the process memory map?
<p>I'm using OS X 10.10.5 now, and I'm doing an experiment about malloc and heap like below:  </p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main() {
    int *p;
    p = malloc(sizeof(int));
    *p = 100;
    printf("the malloc p pointer addr is %x\n", p);
    getchar();
}
</code></pre>

<p>the out put is <code>the malloc p pointer addr is c3404ba0</code>;<br>
I think address <code>0xc3404ba0</code> is allocated by maclloc as part of the process heap.  </p>

<p>Then I use the <code>vmmap</code> tool to get the memory map, the result is:<br>
<a href="https://i.stack.imgur.com/D9YQC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D9YQC.png" alt="enter image description here"></a>  </p>

<p>We can see that the <code>0xc3404ba0</code> is not in the heap area, but it's realy the pointer to the allocated memory. What's wrong with that?  </p>

<hr>

<p>It fix now, when I use %p instead of %x, the output is <code>the malloc p pointer addr is 0x7fe131404ba0</code><br>
and the vmmap output is:<br>
<a href="https://i.stack.imgur.com/Jyz1x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jyz1x.png" alt="enter image description here"></a><br>
thanks to @Alex Lop.</p>