Copying a linked list and returning a pointer to the new list
问题 My current struct is: typedef char AirportCode[4]; typedef struct node{ AirportCode airport; struct node *next; }Node; My idea for how the function should start is this: Node *copy(Node *list) { int count = 0; while (list != NULL){ count++; list = list->next; } } Now we know how long the original list is, but the reason why I am so stumped is because I have no idea how to seperatly allocate the memory for each individual node that we have to copy to the second list. 回答1: You allocate a new