Wiki Markup |
---|
The results of allocating zero bytes of memory using {{malloc()}}, {{calloc()}}, or {{realloc()}} are [implementation-defined|BB. Definitions#implementation-defined behavior]. According to C99 Section 7.20.3 \[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\]: |
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.
...