Q:

What is the return value of malloc (0)?

0

What is the return value of malloc (0)?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

If the size of the requested space is zero, the behavior will be implementation-defined. The return value of the malloc could be a null pointer or it shows the behavior of that size is some nonzero value. It is suggested by the standard to not use the pointer to access an object that is returned by the malloc while the size is zero.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Embedded C interview questions and answers (2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is dynamic memory fragmentation?... >>
<< What is the purpose of realloc( )?...