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

后端 未结 14 1088
天命终不由人
天命终不由人 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:28

    Depending on which system you run it on, nothing will happen, the program will crash, memory will be corrupted, or any other number of interesting effects.

提交回复
热议问题