我想知道add_node_end
函数的确切作用:
typedef struct listint_s {
char *a;
char *b;
struct listint_s *next;
} listint_t;
listint_t *add_node_end(listint_t **head, char *a, char *b) {
listint_t *tmp_node, *new_node;
new_node = malloc(sizeof(listint_t));
if (!new_node)
return (NULL);
new_node->a = a;
new_node->b = b;
new_node->next = NULL;
if (!*head) {
*head = new_node;
return (*head);
}
tmp_node = *head;
while (tmp_node->next)
tmp_node = tmp_node->next;
tmp_node->next = new_node;
return (*head);
}