#2
yuccn2013-03-30 19:39
|
#include<stdio.h>
#include<malloc.h>
typedef char datatype;
typedef struct node
{
datatype data;
struct node *next;
}Linklist;
main()
{
char ch;
Linklist *head,*s,*r;
r = (Linklist*)malloc(sizeof(Linklist));
head = r;
scanf("%c",&ch);
while(ch != '$')
{
s = (Linklist *)malloc(sizeof(Linklist));
s->data = ch;
r->next = s;
r = s;
scanf("%c",&ch);
}
r->next = NULL;
s = head;
while(s->next != NULL)
{
printf("%c ",s->data);
s = s->next;
}
printf("%c ",s->data);
getchar();
}