I assume you mean something like this:
int *iptr = (int*)malloc(/* something */);
And in C, you do not need (and should not) drop the return pointer from malloc. This is a void *and in C, it is implicitly converted to another type of pointer.
int *iptr = malloc(/* something */);
It is the preferred form.
This does not apply to C ++, which does not support the same void *implicit behavior.
source
share