#include<stdio.h>
#include<stdlib.h>
struct Node{
int data;
struct Node *next;
};
typedef struct Node *node;
node create(node list,int x)
{
node newnode,t;
newnode=(struct Node*)malloc(sizeof(struct Node));
newnode->data=x;
newnode->next=NULL;
t=list;
while(t->next!=NULL)
{
t=t->next;
} //无需考虑链表为空
t->next=newnode;
return list;
}
int main()
{
node list;
int n,i,x;
list=(struct Node*)malloc(sizeof(struct Node));
list->next=NULL; //创建头节点
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&x);
list=create(list,x);
}
while(list)
{
list=list->next;
printf("%d,",list->data);
}
return 0;
}