#include<stdio.h>
#include<malloc.h>
#define ERROR 0
#define OK 1
#define EQUAL 1
#define OVERFLOW -1
#define LIST_INIT_SIZE 100
typedef char Sqlist
typedef char ElemType;
typedef struct Sqlist
{
ElemType *elem;
int length;
int listsize;
}sqlist;
int init(sqlist *L)
{
L->elem=(ElemType *)malloc(LIST_INIT_SIZE*sizeof(ElemType));
if(!L->elem) OVERFLOW;
L->length=0;
L->listsize=LIST_INIT_SIZE;
return OK;
for(i=1,i<=n,i++)
scanf("%c",&L->elem);
}
int GetElem(sqlist &L, int i)
{
i=1;
if(i>=1&&i<=L.length)
return L.elem[i];
else printf("参数i不合理!\n");
}
int LocateElem(sqlist *L,ElemType e)
{
int i;
for (i=0;i<L->length;i++)
if (L->elem[i]==e)
return i;
return -1;
}
int listdelet(sqlist *L,int i,ElemType *e)
{
ElemType *p,*q;
if ((i<1)||(i>L->length)) return 0;
p=&(L->elem[i-1]);
*e=*p;
q=L->elem+L->length-1;
for(++p;p<=q;++p)
*(p-1)=*p;
--L->length;
return OK;
}
int printlist(sqlist L)
{
int i;
for(i=0;i<L.length;i++)
printf("%c\t",L.elem[i]);
printf("\n");
}
void main()
{
ElemType i;
Sqlist L;
}
题目呢?
程序运行不对,帮忙调试一下,嗯嗯