以下是出错的代码:
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
#define ERR 0
#define OK 1
#define INIT_SIZE 10
#define INCREMENT_SIZE 5
typedef struct
{
int *elem;
int length;
int size;
}SqList;
int InitList(SqList *L)
{
L->elem = (int *)malloc(sizeof(int) * INIT_SIZE);
if(!L->elem)
{
return ERR;
}
L->length = 0;
L->size = INIT_SIZE;
return OK;
}
int DestoryList(SqList *L)
{
free(L->elem);
L->length = 0 ;
L->size = 0;
return OK;
}
int ClearList(SqList *L)
{
L->length = 0;
return OK;
}
const int IsEmpty(SqList *L)
{
if(L->length == 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
const int GetLength(SqList *L)
{
return L->length;
}
const int GetElem(SqList *L, int i)
{
if(i <= 0 || i > L->length)
{
return ERR;
}
return L->elem[i-1];
}
const int compare(int a, int b)
{
if(a == b)