#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#define size 100
//建立通讯录结构
/*姓名;电话号码 */
typedef struct address_list {
char name[size];
char num[size];
struct address_list *next;
}node;
// 初始化
node *init(node *head)
{
head = (node *)malloc(sizeof(node));
head->next = NULL;
return head;
}
//输出
void print(node *head)
{
node *p;
p = head;
printf("-----------------通讯录-------------------\n");
printf(" \n");
printf("-姓名--------电话号码---------------------\n");
while (p)
{
printf("%-8s %-10s\n", p->name, p->num);
p = p->next;
}
printf("----------------end-----------------------\n");
}
//创建(尾插)
node *create(node *head)
{
node *q, *p;
head = init(head);
int n;
char num[100];
char name[100];
printf("请输入录入学生人数:");
scanf("%d", &n)
数据结构——实验一:用链表实现通讯录(C语言实现)
最新推荐文章于 2023-12-09 10:45:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)