<P> One may "cast" (see type conversion) this pointer to a specific type: </P> <P> There are advantages and disadvantages to performing such a cast . </P> <Ul> <Li> Including the cast may allow a C program or function to compile as C++ . </Li> <Li> The cast allows for pre-1989 versions of malloc that originally returned a char * . </Li> <Li> Casting can help the developer identify inconsistencies in type sizing should the destination pointer type change, particularly if the pointer is declared far from the malloc () call (although modern compilers and static analysers can warn on such behaviour without requiring the cast). </Li> </Ul> <Li> Including the cast may allow a C program or function to compile as C++ . </Li>

When do i need to allocate memory in c