4 ms·
C++ doesn't coerce the void* malloc returns into an int* , C does. You have to write int* foo = (int*)malloc(sizeof(int)); in C++ or the compiler gives a
by wollw 15y ago
C++ doesn't coerce the void* malloc returns into an int* , C does. You have to write
int* foo = (int*)malloc(sizeof(int));
in C++ or the compiler gives a type error.