//順序表的建立、查找、插入與刪除
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#define ListSize 100 //表最大長(zhǎng)度
//結(jié)構(gòu)定義
typedef struct SeqList
{
int node[ListSize] //存放表結(jié)點(diǎn)
int length //當(dāng)前表長(zhǎng)度
} SeqList
//插入元素
insertList(SeqList *list, int e)
{
int i=list->length-1 //先將i指定為最后一項(xiàng)
if(i>=ListSize-1) //表已經(jīng)達(dá)到最大長(zhǎng)度ListSize
{
printf("表已滿,不能增加新的項(xiàng)!\n")
標(biāo)簽:
include
gt
lt
malloc
上傳時(shí)間:
2014-01-17
上傳用戶:dongqiangqiang