标签:etc ret style typedef 输出 turn getch div next
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct Note { char a; struct Note* next; } Note,*list;a void CF(list L) { Note *s; char c; int flag = 1; while(flag) { c = getchar(); getchar(); if(c != ‘$‘) { s=(Note*)malloc(sizeof(Note)); s->a=c; s->next=L->next; L->next=s; } else flag = 0; } } int main() { list L,s; L=(Note*)malloc(sizeof(Note)); L->next=NULL; CF(L); s=L->next; while(s->next!=NULL) { printf("%c ",s->a); s=s->next; } printf("%c\n",s->a); return 0; }
s->a=c;
s->next=L->next;
L->next=s;
注意这三句;
标签:etc ret style typedef 输出 turn getch div next
原文地址:http://www.cnblogs.com/a595452248/p/7662865.html