单向链表实例:终端交互简易通讯录
1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 5 6 typedef struct Contacts_infomation{ 7 char name[13]; 8 char work_unit[61]; 9 char phone_number[12]; 10 char E_mail[61]; 11 struct Contacts_infomation *next; 12 }con_info; 13 14 15 con_info * Creat_node(void) 16 { 17 con_info *new; 18 19 new = (con_info *)malloc(sizeof(con_info)); 20 if(!new){ 21 printf("Malloc Error!\n"); 22 exit(-1); 23 } 24 new->next = NULL; 25 26 return new; 27 } 28 29 int insert_node(con_info ** phead) 30 { 31 con_info *new, *cur; 32 33 cur = *phead; 34 new = Creat_node(); 35 if(!new){ 36 return -1; 37