invalid conversion from `void*’ to `char*’ when using malloc?

In C++, you need to cast the return of malloc()

char *foo = (char*)malloc(1);

Leave a Comment