#include "stdio.h"
struct node
{
struct node *front;
char c;
struct node *next;
};
struct node *input(struct node *top);
int main(void)
{
struct node T,*top=&T,*tail=&T,*p=NULL;
T.front=NULL;
T.next=NULL;
T.c='\0';
tail=input(top);
p=tail->front;
while(p!=NULL)
{
printf("%c",p->c);
p=p->front;
}
return 0;
}
struct node *input(struct node *top)
{
int i=0;
struct node *t;
char x;
while((x=getchar())!='\n')
{
top->c=x;
t=(struct node *)malloc(sizeof(struct node));
top->next=t;
t->front=top;
t->next=NULL;
t->c='\0';
top=top->next;
}
return top;
}
#include
#include
typedef struct Node
{
int data;
struct Node *next;
}Node;
void Creatlist(Node *head,int n)
{
Node *p,*pn;
p=head;
int i;
for(i=1;i<=n;i++)
{
pn=(Node*)malloc(sizeof(Node));
scanf("%d",&pn->data);
pn->next=p->next;
p->next=pn;
}
}
void Printlist(Node *head)
{
Node *p;
p=head;
p=p->next;
while(p!=NULL)
{
printf("%d ",p->data);
p=p->next;
}
}
void main()
{
Node *s;
s->next=NULL;
int n;
scanf("%d",&n);
Creatlist(s,n);
Printlist(s);
}