#include<stdio.h>
#include<stdlib.h>
typedef int ElemType;
#define INITSIZE 100
typedef struct
{
ElemType *data;
int length;
int listsize;
} sqlist;
void initlist(sqlist *l)
{
l->data=(ElemType *)malloc(sizeof(ElemType)*INITSIZE);
l->length=0;
l->listsize=INITSIZE;
}
int getlen(sqlist l)
{
return (l.length);
}
int getelem(sqlist l,int i,ElemType *e)
{
if(i<1||i>l.length)
{
return 0;
}
*e=l.data[i-1];
return 1;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余4页未读,立即下载