xefix
July 23rd, 2010, 04:53 PM
Hey, everyone
I am writing a program in C that uses structs in a linked list to store some data. Each node I make contains both data and pointers to more data (strings, other structs, and the next/prev pointers that I use to maintain the linked lists). When I want to delete such a node, is it enough to simply say free(nodeptr)? Will this also free the memory from all the pointers in the node?
I am writing a program in C that uses structs in a linked list to store some data. Each node I make contains both data and pointers to more data (strings, other structs, and the next/prev pointers that I use to maintain the linked lists). When I want to delete such a node, is it enough to simply say free(nodeptr)? Will this also free the memory from all the pointers in the node?