How to free memory from char array in C

前端 未结 4 976
生来不讨喜
生来不讨喜 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:21

    You don't free anything at all. Since you never acquired any resources dynamically, there is nothing you have to, or even are allowed to, free.

    (It's the same as when you say int n = 10;: There are no dynamic resources involved that you have to manage manually.)

提交回复
热议问题