您的位置:首页 > 其它

单链表的建立,把a~z 26个字母插入到链表中,并且倒叙,还要打印

2018-01-25 19:47 260 查看
#include<stdio.h>
#include<stdlib.h>

typedef struct linklist
{
char ff;
struct linklist *next;
}Node;
typedef Node* Linklist;

int main()
{
Linklist L, new;
L = (Linklist)malloc(sizeof(Node));
L->next = NULL;
int i;
for(i = 0; i < 26; i++)
{
new = (Linklist)malloc(sizeof(Node));
new->ff = 'a' + i;
new->next = L->next;
L->next = new;
}
while(L->next)
{
printf("%c ", L->next->ff);
L = L->next;
}
printf("\n");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐