How to free this memory?

From: bugzilla (mozilla.bugzilla_at_gmail.com)
Date: 03/29/05


Date: 29 Mar 2005 08:46:27 -0800

hi, there,

Please help me to figure out this problem. In the following code
segment, how to free the momory allocated to "head" in {STULST*
CreateList()} in main() function? thanks

///////////////////////////////////////////

#include <stdio.h>

typedef struct
{
        int num;
        float score;
}STUDENT;

typedef struct STULST
{
        STUDENT *stu;
        struct STULST* next;
}STULST;

STULST* CreateList()
{
        
        STULST *head;
        head=(STULST *)malloc(sizeof(STULST));
        head->stu=NULL;
        head->next=NULL;
        return head;
}

int main()
{
STULST* head;

head=CreateList();
/// how to free the memory of head;

return 0;
  

}