郁闷啊,怎么才能学好链表
怎样用字符串代替字符呢?就是把他改成字符串型
一直做不出来~郁闷ing
#include<stdio.h>
#include<stdlib.h>
#include "1.h"
void createstack(struct intncode **headp)
{
char n;
struct intncode *p;
printf("input numbers end of 0:\n");
scanf("%c",&n);
while(n!='0')
{
p=(struct intncode *)malloc(sizeof(struct intncode));
p->data=n;
p->next=*headp;
*headp=p;
scanf("%c",&n);
}
}
void sort(void)
{
int d=0;
struct intncode *head,*p;
head=NULL;
createstack(&head);
p=head;
while(p!=NULL)
{
printf("%c",p->data);
p=p->next;
d++;
}
printf("\n");
printf("%d\n",d-1);
}
void main(void)
{
sort();
}