#include<stdio.h>//无头节点
#include<stdlib.h>
typedef struct List
{
int val;
struct List *next;
}list;
void a(list *pst)
{
pst=pst->next;
}
int main()
{
list *head,*last,*p;
head=NULL;
int i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
p=(list*)malloc(sizeof(struct List));
scanf("%d",&(p->val));
p->next=head;
head=p;
}
a(head);
while(head)
{
printf("%d ",head->val);
head=head->next;
}
}
将头指针传递给函数,函数功能是指针移向下一节点,为什么该函数a没起到作用