How to free memory from char array in C

前端 未结 4 929
生来不讨喜
生来不讨喜 2021-02-01 15:15

I created a char array like so:

char arr[3] = \"bo\";

How do I free the memory associated with array I named \"arr\"?

4条回答
  •  既然无缘
    2021-02-01 15:46

    char arr[3] = "bo";
    

    The arr takes the memory into the stack segment. which will be automatically free, if arr goes out of scope.

提交回复
热议问题