📌  相关文章
📜  在列表 c 中添加最后一个 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:26.155000             🧑  作者: Mango

代码示例1
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;
    

}