我是想用链表来存放一串字符的啊,为什么通不过呢??
#include"stdio.h" #include"malloc.h" struct string { char a; char *next; }; void main() { struct string *p1,data; char *p; p1=&data; p=(char*)malloc(sizeof(struct string)); p1->next=p; printf("please Enter the string."); scanf("%c",p1->a); if(p1->a!='\n') { p=(char *)malloc(sizeof(struct string)); p1->next=p; scanf("%c",p1->a); } else p1->next=NULL; }