代码如下:
#include <stdlib.h>
int num = 3; // Static external variable
int *ptr = #
int main(void)
{
int num2 = 4; // Automatic variable
int *ptr2 = &num2;
free(ptr); //Free static variable
free(ptr2); //Free automatic variable
return 0;
}
我尝试编译上述代码,它可以工作,但我很好奇free()
函数是否能够释放静态变量和自动变量?还是说它基本上什么也不做?