我有以下内容struct
:
typedef struct cell Cell;
struct cell {
int value;
int *nextcell;
};
我有以下功能来释放链表:
void freelist(Cell *beginning)
{
Cell *thisCell = beginning;
Cell *NextCell = beginning->nextcell;
while (thisCell != NULL)
{
NextCell = thisCell->nextcell;
free(thisCell);
thisCell = NextCell;
}
/* Here comes my question. Do I need to free the following variables? */
free(beginnig);
free(thisCell);
free(NextCell);
}