编译没问题,但运行不显示结果
#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);
} q -> size = 10
q -> length = 0
难道有什么不对吗?
页:
[1]