Phoxxent Phoxxent - 3 months ago 12
C Question

Does free have a return value?

So, in C when I'm freeing memory with

free
, does that provide any sort of return value for whether or not it successfully frees the memory? For example, could I do:

if(free(myptr))
doThing();
else
doOtherThing();


in a program?

Answer

No, the prototype for free is

void free(void*);
Comments