I would have written it as:
Code:
void printnode(Area *current) {
if (current) {
printf("\n<%d||[%p]>: <%p|%p>\n",
current->name, current, current->prev, current->next);
printnode(current->next);
}
}
Observe the tail recursion. It is easy to transform it to:
Code:
void printnode(Area *current) {
while (current) {
printf("\n<%d||[%p]>: <%p|%p>\n",
current->name, current, current->prev, current->next);
current = current->next;
}
}
In which case you would no longer have the limitations of recursion depth.