Posso liberar () variáveis estáticas e automáticas em C?
O código é o seguinte:
#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;
}
Eu tento compilar o código acima e funciona, estou curioso que ofree()
função capaz de liberar tanto a variável estática e também variável automática? Ou basicamente não faz nada?