What happens when you try to free() already freed memory in c?

后端 未结 14 1077
天命终不由人
天命终不由人 2020-12-09 08:19

For example:

char * myString = malloc(sizeof(char)*STRING_BUFFER_SIZE);
free(myString);
free(myString);

Are there any adverse side effects

14条回答
  •  情话喂你
    2020-12-09 08:24

    In short: "Undefined Behavior".

    (Now, what that can include and why that is the case the others have already said. I just though it was worth mentioning the term here as it is quite common).

提交回复
热议问题