怎么在链表中输入数据啊???
下面是偶写的创建循环列表的函数(顺便看下有没有错误的地方)。问题是怎么在这个链表中加入数据啊??(struct student{ int code;int no; struct student *next})先谢过了。。。。。struct student *creat(int n)
{
struct student *head,*pnew,*ptail;
int i;
pnew=(struct student *)malloc(sizeof(struct student));
scanf("%s%f",pnew->code,&pnew->no);
head=ptail=pnew;
for(i=1;i<n;i++){
pnew=(struct student *)malloc(sizeof(struct student));
scanf("%s%f",pnew->code,&pnew->no);
ptail->next=pnew;
ptail=pnew;}
ptail->next=head;return head;}