为什么第二次调用show_all还能打印出数据,指针不是已经到了链表的最后了吗

#include
#include
struct student
{
int num;
float score;
struct student pnext;
};
typedef struct student st;
void add(st **phead, int inum, float iscore)
{
if (*phead == NULL)
{
st *newnode = (st
)malloc(sizeof(st));
newnode->num = inum;
newnode->score = iscore;
newnode->pnext = NULL;
phead = newnode;
}
else
{
st *p = *phead;
while (p->pnext != NULL)
{
p = p->pnext;
}
st *newnode = (st
)malloc(sizeof(st));
newnode->num = inum;
newnode->score = iscore;
newnode->pnext = NULL;
p->pnext = newnode;
}
}
void show_all(st*head)
{
while (head != NULL)
{
printf("%d,%f\n", head->num, head->score);
head = head->pnext;
}
}
void main()
{
st *head=NULL;
add(&head, 1, 20);
add(&head, 2, 30);
add(&head, 3, 40);
add(&head, 4, 50);
add(&head, 5, 60);
show_all(head);
printf("\n");
show_all(head);
system("pause");
}

有几个地方少了*

 #include<iostream>
using namespace std;
struct student
{
    int num;
    float score;
    struct student *pnext;
};
typedef struct student st;
void add(st **phead, int inum, float iscore)
{
    if (*phead == NULL)
    {
        st *newnode = (st*)malloc(sizeof(st));
        newnode->num = inum;
        newnode->score = iscore;
        newnode->pnext = NULL;
        *phead = newnode;
    }
    else
    {
        st *p = *phead;
        while (p->pnext != NULL)
        {
            p = p->pnext;
        }
        st *newnode = (st*)malloc(sizeof(st));
        newnode->num = inum;
        newnode->score = iscore;
        newnode->pnext = NULL;
        p->pnext = newnode;
    }
}
void show_all(st*head)
{
    while (head != NULL)
    {
        printf("%d,%f\n", head->num, head->score);
        head = head->pnext;
    }
}
void main()
{
    st *head=NULL;
    add(&head, 1, 20);
    add(&head, 2, 30);
    add(&head, 3, 40);
    add(&head, 4, 50);
    add(&head, 5, 60);
    show_all(head);
    printf("\n");
    show_all(head);
    system("pause");
}

图片说明

复制的问题,我主要想知道,调用show的时候,head不是改变了吗,为什么第二次调用依然能打印。如果把ADD函数改成add(head,1,70)最后调用show时会什么都不打印,但是传递head的地址就可以打印。