#include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
struct node
{
int num;
struct node *next,*prior;
};
struct node *createlink(int n)
{
int i;
struct node *head,*p,*q;
head=(struct node*)malloc(sizeof(struct node));
head->next=NULL;
q=head;
head=(struct node*)malloc(sizeof(struct node));
//head->next=head;
q=head;
for(i=0;i<n;i++)
{
p=(struct node*)malloc(sizeof(struct node));
scanf("%d",&p->num);
p->next=q->next;
//q->next=p;
//q=p;
q->next=p;
p->prior=q;
q=p;
}
q->next=head;
head->prior=q;
free(p);
return head;
//q->next=head;
//return head;
}
int main()
{
struct node *head;
head=createlink(3);
return 0;
}
#include<cstdlib>
#include<iostream>
using namespace std;
struct node
{
int num;
struct node *next,*prior;
};
struct node *createlink(int n)
{
int i;
struct node *head,*p,*q;
head=(struct node*)malloc(sizeof(struct node));
head->next=NULL;
q=head;
head=(struct node*)malloc(sizeof(struct node));
//head->next=head;
q=head;
for(i=0;i<n;i++)
{
p=(struct node*)malloc(sizeof(struct node));
scanf("%d",&p->num);
p->next=q->next;
//q->next=p;
//q=p;
q->next=p;
p->prior=q;
q=p;
}
q->next=head;
head->prior=q;
free(p);
return head;
//q->next=head;
//return head;
}
int main()
{
struct node *head;
head=createlink(3);
return 0;
}