#include<stdio.h>
#include<malloc.h>
typedef struct LNode{
char str;
struct LNode *next;
}LNode,*LinkList;
int main(){
LNode *head;
head=(LNode*)malloc(sizeof(LNode));
head->next=NULL;
LNode *p;
char ch;
while(1){
ch=getchar();
if(ch=='\n'){
break;
}
p=(LNode*)malloc(sizeof(LNode));
p->str=ch;
p->next=head->next;
head->next=p;
}
LNode *m=head->next;
while(m!=NULL){
printf("%c",m->str);
m=m->next;
}
return 0;
}
链表倒序输出字符串
最新推荐文章于 2024-07-20 11:22:21 发布