请帮个忙
#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
typedef struct list
{
int data;
struct list *next;
}node;
/*创建链表函数*/
node *creat(int n)
{
int i,x;
node *head;
node *p,*q;
i=1;
head=(node *)malloc(sizeof(node));
p=head;
while(i<=n)
{
q=(node *)malloc(sizeof(node));
printf("input the node\n");
scanf("%d",&x);
q->data=x;
p->next=q;
p=p->next;
}
p->next=NULL;
q=head;
head=head->next;
free(q);
return(head);
}
/*输出链表函数*/
void print(node *head)
{
node *p;
p=head;
while(p!=NULL)
{printf("%d",p->data);}
}
void main()
{ /*建立一个逆续链表并输出*/
int n,t;
node *head1;
scanf("%d",&n);
printf("creat a %d list\n",n);
head1=creat(n);
printf("output the list\n");
print(head1);
scanf("%d",&t);
}