title: Casting a pointer to an int
body: <p>I am writing my own functions for <code>malloc</code> and <code>free</code> in C for an assignment. I need to take advantage of the C <code>sbrk()</code> wrapper function. From what I understand <code>sbrk()</code> increments the program's data space by the number of bytes passed as an argument and points to the location of the program break.</p>
  
  <p>If I have the following code snippet:</p>
  
  <p><code>#define BLOCK_SIZE 20</code></p>
  
  <p><code>int x;</code></p>
  
  <p><code>x = (int)sbrk(BLOCK_SIZE + 4);</code></p>
  
  <p>I get the compiler error <code>warning: cast from pointer to integer of different size</code>. Why is this and is there anyway I can cast the address pointed to by <code>sbrk()</code> to an <code>int</code>? </p>