#include <stdio.h>
#include <malloc.h>
struct L {
char t;
struct L *prev;
struct L *next;
};
typedef struct L Link;
Link *createLink(){
Link *temp = (Link*)malloc(sizeof(Link));
return temp;
}
void print(Link *ptr){
while(ptr!=NULL){
printf("%c\t",ptr->t);
ptr=ptr->next;
};
}
int frees(Link *ptr){
if(ptr!=NULL&&ptr->next!=NULL){
frees(ptr->next);
printf("销毁%c\t",ptr->t);
free(ptr);
printf("销毁%c\t",ptr->t);
}
return 1;
}
int main () {
Link *a=NULL,*b=NULL,*hand=createLink();
hand->next = hand;
hand->prev = hand;
hand->t = 90;
a = hand;
for(int i=70;i==70;i++){
b = createLink();
b->t = i;
a->next = b;
b->prev = a;
b->next = NULL;
a = b;
};
print(hand);
printf("\n");
frees(hand);
return 0;
}