更新时间:2023-02-17 14:38:59
那不只是释放实际的指针,而不是释放每个字符串本身正在使用的内存吗?
won't that just free the actual pointers and not the memory each string itself was using?
是的.
我如何完全释放内存
How do I completely free the memory
通过遍历数组并在 释放数组本身之前一一释放每个字符串.例如
By looping through the array and freeing each string one by one before freeing up the array itself. E.g.
for (i = 0; i < SOMETHING; i++) {
free(list[i]);
}
free(list);