#include<iostream>
using namespace std;
struct list{
int num;
struct list*next;
};
int main()
{
int n;
cin>>n;
struct list *head;
head=(list*)malloc(sizeof(list));
head->next=NULL;
list *tmp1=head;
for(int i=0;i<n;i++)
{
list *tmp = (list*)malloc(sizeof(list));
cin >> tmp->num; //节点输入
tmp1->next=tmp;
tmp1 = tmp1->next;
//tmp1 = tmp;
tmp->next=NULL;
}
tmp1 =head->next;
while(tmp1 !=NULL)
{
cout << tmp1->num << " ";
tmp1 = tmp1->next;
}
return 0;
}

京公网安备 11010502036488号