實現了使用c語言完成順序表的插入,排序(氣泡排序),刪除。
#define maxsize 100
//順序表定義
typedef
struct
sqlist;
intmain()
//順序表基本操作
//建立順序表
void
creatsqlist
(sqlist *l)
}//輸出順序表
void
outputsqlist
(sqlist *l)
printf
("\n");
}//順序表插入,按順序插入
intfindelem
(sqlist l,
int x)
}return i;
}void
insertelem
(sqlist *l,
int x)
l->data[p]
= x;
(l->length)++;
}//刪除元素
intdeleteelem
(sqlist *l,
int p,
int*e)
e = l->data[p]
;for
(i = p;i < l->length-
1;i++
) l->length--
;return1;
}//氣泡排序
void
bubble
(sqlist *l)}}
}
c語言實現順序表的基本操作
資料結構順序表操作 複製 如下 include include include define list init size 100 define lisincrement 10 define elemtype int define status int typedef struct sqsqlist...
C語言實現順序表基本操作彙總
include include define true 1 define false 0 define ok 1 define error 0 define overflow 2 define list init size 100 define listincrement 10 typedef in...
順序表的基本操作用c語言實現
include include include define initsize 20 typedef structsqlist bool initlist sqlist l bool listinsert int i,int x,sqlist l bool listdelete int i,sqli...