📅  最后修改于: 2022-03-11 14:59:26.155000             🧑  作者: Mango
void addLast(struct node **head, int val)
{
//create a new node
struct node *newNode = malloc(sizeof(struct node));
newNode->data = val;
newNode->next = NULL;
//if head is NULL, it is an empty list
if(*head == NULL)
*head = newNode;
}