Alex Rivera | Logout

How to free a struct that contains only pointers

Asked 2011-02-06T18:53:45.780
11

I have a struct which you see below:

typedef struct _List {
    Person *person; // pointer for people list
    DoList *do; // Kinda timer, for checking list in some intervals
} List;

Are there any need to free this struct? If so, how can i free it?

Edit
Report

1 Answer

4

If you have allocated an object using malloc(), then you need to free() it at some point.

answered 2011-02-06T18:55:58.793

Your Answer