Return code for malloc()?

Posted By: Caermundh

Return code for malloc()? - 08/22/09 12:05

does anyone know if the malloc() function has any kind of a return code? IE if it fails to allocate some memory?
Posted By: EvilSOB

Re: Return code for malloc()? - 08/22/09 12:07

It returns NULL on any type of fail.
Posted By: Caermundh

Re: Return code for malloc()? - 08/22/09 12:39

thanks!
Posted By: Saturnus

Re: Return code for malloc()? - 08/22/09 13:53

But keep in mind, that malloc(0) will not return NULL, but a pointer to non allocated memory.
© 2023 lite-C Forums