problems with 'free' in C

Posted by lego69 on Stack Overflow See other posts from Stack Overflow or by lego69
Published on 2010-05-12T14:08:13Z Indexed on 2010/05/12 14:14 UTC
Read the original article Hit count: 148

Filed under:

hello, can somebody please explain can I free const char* ? I allocated new memory using malloc and when I'm trying to free it I always receive an error incompatible pointer type thanks in advance

something like this

char* name="Arnold";
const char* str=malloc(stlen(name)+1);

free(str);  <- here bug

© Stack Overflow or respective owner

Related posts about c