线性表疑问?
#include <stdio.h>#include <stdlib.h>
#include <iostream.h>
#define OK 1
#define ERROR 0
#define OVERFLOW -2
typedef int ElemType;
typedef int Status;
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef struct
{
ElemType *elem;//elem是整数类型的指针吗?
int length;
int listsize;
}SqList;
Status InitList_Sq(SqList &L)
{
int i;
L.elem = (ElemType * )malloc(LIST_INIT_SIZE*sizeof(ElemType));//L.elem的数据类型是指针类型吗?
if (! L.elem) exit (OVERFLOW);
for(i=1;i<=5;i++)
{
printf("input elem:\n");
scanf("%d",&L.elem[i-1]);
}
L.listsize = LIST_INIT_SIZE;
return OK;
}