这个动态链表怎么回事?
#include<stdio.h>#include<stdlib.h>
main()
{
struct worker
{
char name[20];
int age;
int salary;
struct worker *next;
};
struct worker *head,*p1,*p2,*p;
int i;
i=0;
p1=(struct worker *)malloc(sizeof(struct worker));
printf("name age salary\n");
scanf("%s %d %d",&p1=>name,&p1->age,&p1->salary);
while(p1->name!=0)
{
head=NULL;
i=i++;
if(i==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(struct worker *)malloc(sizeof(struct worker));
printf("name age salary");
scanf("%s %d %d",&p1->name,&p1->age,&p1->salary);
}
p2->next=NULL;
p=head;
if(head!=NULL)
printf("Name age salary\n");
for(;p=NULL;p=p->next)
printf("%s %d %d",p->name,p->age,p->salary);
}