General
#General GoodGood work for a C newcomer! Welcome to the club!
#General Good work for a C newcomer! Welcome to the club!
General
Good work for a C newcomer! Welcome to the club!
- 87.3k
- 14
- 104
- 322
freeInnerNodes()
will recurse as deeply as the list is long. We can easily avoid that., by iterating through the list instead:
void freeInnerNodes(struct HashItem * node)
{
while (node) {
struct HashItem *next = node->tail;
freeNode(node);
node = next;
}
}
freeInnerNodes()
will recurse as deeply as the list is long. We can easily avoid that.
freeInnerNodes()
will recurse as deeply as the list is long. We can easily avoid that, by iterating through the list instead:
void freeInnerNodes(struct HashItem * node)
{
while (node) {
struct HashItem *next = node->tail;
freeNode(node);
node = next;
}
}
Thank you for providing a good test program, and for the macro to exercise the list code - that really helps give confidence in the codeimplementation. The tests do have some limitations, since they only test inserting elements and freeing the entire table; there's no tests of lookup, updating values or removing single entries, for example. Tests of removal should remove elements from beginning, end and interior of lists, and of singleton lists.
Thank you for providing a good test program, and for the macro to exercise the list code - that really helps give confidence in the code.
Thank you for providing a good test program, and for the macro to exercise the list code - that really helps give confidence in the implementation. The tests do have some limitations, since they only test inserting elements and freeing the entire table; there's no tests of lookup, updating values or removing single entries, for example. Tests of removal should remove elements from beginning, end and interior of lists, and of singleton lists.