#include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int name[5];
struct node *next;
} student;
struct node* creatList(int n)
{
int i=0;
student *head,*p;
head=(student*)malloc(sizeof(student));
head->next=NULL;
printf("请输入%d个数据,来创建链表
",n);
for(;i<n;i++)
{
p=(student*)malloc(sizeof(student));
//printf("%p",p);
scanf("%s",&(p->name));
p->next=head->next;
head->next=p;
}
return head;
}
void insertNode(student* node,int index)
{
student *newnode,* p=node->next;
int n=0;
while(p&& n<index)
{
p=p->next;
n++;
}
newnode=(student*)malloc(sizeof(student));
scanf("%s",&(newnode->name));
newnode->next=p->next;
p->next=newnode;
if(!p)
{
return ;
}
}
void printOn(student* head)
{
student* p=head->next;
while(p)
{
printf("%s",p->name);
p=p->next;
}
}
int main()
{
student *p=creatList(5);
printOn(p);
return 0;
}