typedef struct chain {
char data;
struct chain* next;
}jd;
void DGlist(jd* &head,int n) // n是长度
{
if (n == 0)
head = NULL;
else
{
head = (jd*)malloc(sizeof(jd));
char a;
scanf("%c", &a);
head->data = a;
DGlist(head->next, --n);
}
}
void Print(jd* L)
{
if (L != NULL)
printf("%c", L->data);
else return;
Print(L->next);
}
void main()
{
jd* head = NULL;
printf("请输入链表的数据:");
DGlist(head,5);
Print(head);
}
11-30
2119
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)