What is the portable way to check whether malloc failed to allocate non-zero memory block?
malloc
According to the Single Unix Specification, malloc will return NULL and set errno when it fails.
NULL
errno
2.1m questions
2.1m answers
60 comments
57.0k users