Casting the return of malloc(), calloc() and realloc() or not?


According to the discussion Do I cast the result of malloc? , in C it is not recommended or correct to cast the return of malloc() . calloc() also apply to the calloc() and realloc() ?

Taking advantage, is it correct to say cast , casting or are both correct?


Yes, the functions have the same issues, because in essence they return the same thing, only what is done internally is different.

I don't think language is our focus, but it always depends on the context to define the correct word, both can be used in the context of programming, each in a more specific context has a different grammatical meaning, but nothing that directly interferes with the concept of the schedule.

Scroll to Top