c程序求助.从键盘输入10个整数,编写函数完成下列事项:(1)建立10个结点的单链表;(2)将单链表进行输出。
求助....在考试..急啊
#include<搭卖stdio.h>知者逗
#include<malloc.h>
struct link {
int integer;
link *next;
}*head,*last,*t;
int main()
{
int i;
head =last= NULL;
for( i=0; i< 10; i++)
{
t=(link *)malloc(sizeof(link));
scanf("%d", &t->integer);
t->嫌仿next=NULL;
if( last== NULL)
{
head = last = t;
}
else last = last->next =t;
}
t=head;
while(t!=NULL)
{
printf("%d\n", t->integer);
t= t->next;
}
return 0;
}