Supponiamo di avere la seguente struttura:
struct str{
int lun;
char *pun;
} rec;
per allocarla faccio
rec *x;
x = (rec*)calloc (1,sizeof(rec));
x->pun = (char *)calloc(10,sizeof(char));
giusto?
e per liberare lo spazio occupato bisogna fare
free (x);
o
free (x->pun);
free (x);
?
Rispondete che poi ho altri dubbi!
|