RealityVelJackson
Programmer
I've seen 'lots' of C code that explicitly casts the ptr returned by malloc, yet I hear that this is not always necessary. Just when is it necessary (if ever) ? Does the situation differ between C and C++ (even though you'd probably use 'new' in C++) ?
Does malloc() always perform an implicit cast before returning the pointer ?
Thanks,
Jason
Code:
MYTYPE* a = (MYTYPE*) malloc(sizeof(MYTYPE));
MYTYPE* a = malloc(sizeof(MYTYPE);
Does malloc() always perform an implicit cast before returning the pointer ?
Thanks,
Jason