title: Why does malloc(0) return a non-null address in Windows?
body: <p>The code below returns an address when executed in Windows, though I was expecting it to return NULL.</p>
  
  <pre><code>int main()
  {
     char *ptr = NULL;
     ptr = malloc(0);
     printf("malloc returned = %u\n", ptr);
  
  }
  </code></pre>
  
  <p>What could have prompted such an implementation of malloc? Is there any reason behind it? </p>
  
  <p>Since, this is a 0 byte memory, I didn't experiment writing any data. But, can this memory be used for anything at all?</p>