How to free this memory?
From: bugzilla (mozilla.bugzilla_at_gmail.com)
Date: 03/29/05
- Next message: bjrnove: "Re: Usual Arithmetic Conversions-arithmetic expressions"
- Previous message: Al Bowers: "Re: malloc problem"
- Next in thread: bjrnove: "Re: How to free this memory?"
- Reply: bjrnove: "Re: How to free this memory?"
- Reply: bjrnove: "Re: How to free this memory?"
- Reply: Emmanuel Delahaye: "Re: How to free this memory?"
- Reply: Al Bowers: "Re: How to free this memory?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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;
}
- Next message: bjrnove: "Re: Usual Arithmetic Conversions-arithmetic expressions"
- Previous message: Al Bowers: "Re: malloc problem"
- Next in thread: bjrnove: "Re: How to free this memory?"
- Reply: bjrnove: "Re: How to free this memory?"
- Reply: bjrnove: "Re: How to free this memory?"
- Reply: Emmanuel Delahaye: "Re: How to free this memory?"
- Reply: Al Bowers: "Re: How to free this memory?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]