代码如下:
#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()
函数是否能够同时释放静态变量和自动变量?还是基本上什么都不做?