lianbiao3.c
来自「链表的测试 使用方式 添加,删除方法的实现」· C语言 代码 · 共 40 行
C
40 行
#include "stdlib.h"
#include "stdio.h"
#include "conio.h"
#define null NULL
struct list
{
int data;
struct list *next;
};
typedef struct list link;
typedef link *links;
links *head,e;
void start()
{
e->data=null;
e->next=null;
head=&e;
}
void add(int i)
{
e->next=(links *)malloc(sizeof(link));
e=e->next; /*移动e指向下一个*/
e->data=i;
e->next=null;
}
main()
{
start();
add(4);
add(5);
add(6);
e=a->next;
printf("%d\n",e->data);
e=e->next;
printf("%d\n",e->data);
e=e->next;
printf("%d\n",e->data);
getch();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?