标签:ack 一个 href style script center 整数 结束 test
12 56 4 6 55 15 33 62 -1
62 33 15 55 6 4 56 12
1 #include<stdio.h> 2 #include<malloc.h> 3 4 struct node 5 { 6 int data; 7 struct node *next; 8 }; 9 struct node *Creat() 10 { 11 struct node *head,*p; 12 head=(struct node *)malloc(sizeof(struct node)); 13 head->next=NULL; 14 p=(struct node *)malloc(sizeof(struct node)); 15 scanf("%d",&p->data); 16 while(p->data!=-1) 17 { 18 p->next=head->next; 19 head->next=p; 20 p=(struct node *)malloc(sizeof(struct node)); 21 scanf("%d",&p->data); 22 } 23 return (head); 24 } 25 26 int main() 27 { 28 struct node *head; 29 head=Creat(); 30 if(head->next!=NULL) 31 { 32 printf("%d",head->next->data); 33 head=head->next; 34 } 35 while(head->next!=NULL) 36 { 37 printf(" %d",head->next->data); 38 head=head->next; 39 } 40 printf("\n"); 41 return 0; 42 }
标签:ack 一个 href style script center 整数 结束 test
原文地址:https://www.cnblogs.com/xiaolitongxueyaoshangjin/p/12063657.html