How can I free a const char*? I allocated new memory using malloc, and when I\'m trying to free it I always receive the error \"incompatible pointe
const char*
malloc
I could be wrong but I think the problem lies in const. Cast the pointer to non-const like:
const
free((char *) p);
Because with const you say: Don't change the data this pointer points to.