prev up next   top/contents search

comp.lang.c FAQ list · Question 11.26

Q: What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?


A: The ANSI/ISO Standard says that it may do either; the behavior is implementation-defined (see question 11.33). Portable code must either take care not to call malloc(0), or be prepared for the possibility of a null return.

References: ISO Sec. 7.10.3
PCS Sec. 16.1 p. 386


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North