请问哪位高手可以告诉我一下,我的数据结构哪里出错了??

来源:百度知道 编辑:UC知道 时间:2024/06/15 08:45:06
#include<string.h>
#include<ctype.h>
#include<malloc.h> /* malloc()等 */
#include<limits.h> /* INT_MAX等 */
#include<stdio.h> /* EOF(=^Z或F6),NULL */
#include<stdlib.h> /* atoi() */
#include<io.h> /* eof() */
#include<math.h> /* floor(),ceil(),abs() */
#include<process.h> /* exit() */

typedef int ElemType;
typedef int Status;
#define OK 1
#define OVERFLOW -2
#define ERROR 0
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef struct {
ElemType *elem;
int length;
int listsize;
}Sqlist
Status InitList_Sq(Sqlist *L) // 算法2.3
{ // 构造一个空的线性表L
L->elem=(ElemType *)malloc (LIST_INIT_SIZE *sizeof(ElemType));
if(!L->elem)exit(OVERFLOW); // 存储分配失败
L->length=0; // 空表长度为0
L->listsize=LIST_INIT_SIZE; // 初始存储容量
return OK;
}

我简单看了一下有几个很明显的错误
typedef struct {
ElemType *elem;
int length;
int listsize;
}Sqlist
Sqlist 后要加分号;
SqList *L 你结构体定义的是Sqlist "l"是小写,注意大小写
还有几个函数也是,前面用小写了,后面也要跟着小写,c是区别
大小写的
--L->ength ....是length吧 多检查一下拼写
getch()需要头文件<conio.h>
最后的main函数怎么加了3个}}}?
先把这些细节错误全纠正了再说