#include
#include
#include
#include
#include
typedef struct lianbiao
{
int a;
struct lianbiao* next;
} lb;
void print(lb *head);
main()
{
int n=5;
lb *head=NULL,*wei=NULL,*ls;
while(n--)
{
ls=malloc(sizeof(lb));
if(ls==NULL)
{
printf("error!\n");
exit(0);
}
scanf("%d",&ls->a);
ls->next=NULL;
if(head==NULL)
{
head=ls;
wei=ls;
}
else
{
wei->next=ls;
wei=ls;
}
}
print(head);
}
void print(lb *head)
{
lb* ls=head;
while(ls!=NULL)
{
printf("%d\n",ls->a );
ls=ls->next;
}
}
dev cpp 5.11 能过= =