I have a question regarding the for loop in the release list func. (The head is a dummy so we don't need to release it). I don't understand the:
next = next?
part in the loop. What does it actually do, and why simply
next?
won't suffice? here is the code:
typedef struct NODE {
int num;
struct NODE* next;
} Node;
void release_list(Node* head) {
Node* next = head->next ? head->next->next : NULL;
for( Node* curr = head->next;
curr != NULL;
curr = next, next = next? next->next : NULL) {
free(curr);
}
}