Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When the requested size is zero the behavior of the memory allocation functions malloc(), calloc(), and realloc() is implementation-defined. Section 7.22.3 of the C standard [ISO/IEC 9899:2011] states:

If the size of the space requested is zero, the behavior is implementation-defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object.

...