OJ上提交没有PE。
#include <stdio.h>
#include <stdlib.h>
struct node
{
int data;
struct node *next;
};
int main()
{
int i,n;
struct node *head,*p;
head=(struct node*)malloc(sizeof(struct node));
head->next=NULL;
scanf("%d",&n);
for(i=0;i<n;i++)
{
p=(struct node*)malloc(sizeof(struct node));
scanf("%d",&p->data);
p->next=head->next;
head->next=p;
}
while(p)
{
printf("%d ",p->data);
p=p->next;
}
return 0;
}