标签:include next node getch nod 循环 stdio.h list tchar
1 #include<stdio.h> 2 #include<stdlib.h> 3 typedef struct Node 4 { 5 char a; 6 struct Node *next; 7 }Node,*list; 8 9 void p(list L); 10 int main() 11 { 12 list L,s; 13 L=(list)malloc(sizeof(Node)); 14 L->next=L; 15 p( L); 16 s=L; 17 while(s->next!=L) 18 { 19 s=s->next; 20 printf("%c ",s->a); 21 } 22 printf("\n"); 23 return 0; 24 } 25 26 void p(list L) 27 { 28 list r,s; 29 char c; 30 r=L; 31 c=getchar(); 32 while(c!=‘\n‘) 33 { 34 s=(list)malloc(sizeof(Node)); 35 s->a=c; 36 r->next=s; 37 r=s; 38 c=getchar(); 39 } 40 r->next=L; 41 }
标签:include next node getch nod 循环 stdio.h list tchar
原文地址:http://www.cnblogs.com/a595452248/p/7718866.html