Basic and Advance C Question: Download Questions PDF
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Answer:
The ANSI/ISO Standard says that it may do either; the behavior is implementation-defined ortable code must either take care not to call malloc(0), or be prepared for the possibility of a null return.
Download C Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed? | How can I dynamically allocate arrays? |