|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
#include<stdlib.h>
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INIT_SIZE 10
#define INCREMENT_SIZE 5
typedef int Status;
typedef int Elemtype;
typedef struct{
Elemtype *elem;
int length;
int size;
}SqList;
Status InitList(SqList *L){
L->elem=(Elemtype *) malloc(INIT_SIZE*sizeof(Elemtype));
if(!L->elem){
return ERROR;
}
L->length=0;
L->size=INIT_SIZE;
return OK;
}
int main(){
SqList *q;
InitList(q);
printf("线性表的现有数据长度:");
printf("%d\n",q->length);
printf("线性表的总长度:");
printf("%d",q->size);
} |
|