该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include "stdio.h"
#include "malloc.h"
struct word
{
char c;
struct word *next;
};
struct word *input()
{
struct word *head,*p1,*p2;
char c;
head=(struct word *)malloc(sizeof(struct word));
head->c=0;
head->next=NULL;
p1=head;
while(1){
if((c=getchar())!=8){
putchar(c);
p2=(struct word *)malloc(sizeof(struct word));
p2->next=NULL;
p1->next=p2;
p2->c=c;
p1=p2;
}
else if(c==8){
putchar(c);
putchar(' ');
p2->c=NULL;
}
else if(c=='\n'){
return head;
}
}
}
main(){
struct word *head,*p1;
head=input();
p1=head;
while(p1->next!=NULL){
printf("%c",p1->c);
p1=p1->next;
}
system("pause");
}
这个,无限输入+兼容退�