链表处理
具有功能:创建链表,打印链表,寻找某个元素在链表中的位置,找出某个位置的元素,删除节点,插入节点
//Header file declaration
#include<stdio.h>
#include<stdlib.h>
//type declaration
typedef struct LIST LIST;
//variable declaration
struct LIST{
//the position of the node of the list(head is 0)
int position;
int num;
LIST* next;
};
int n;
//function declaration
LIST *creatlist();
void listprint(LIST *head);
int isempty(LIST *head);
int islast(LIST *p,LIST *head);
int findlist(int X,LIST *head);
LIST *findprelist(int X,LIST *head);
void deletelist(int X,LIST *head);
LIST *findposition(int n,LIST *head);
void insertlist(int X,LIST *p,LIST *head);
//function1: creat list function
LIST *creatlist(){
//Initial definition
LIST *head;
LIST *p,*h;
head=(LIST *)malloc(sizeof