c 语言程序错误 (找错误) 程序如下 #include<stdio.h> #include<stdlib.h> #define TRUE 1 #define FALS

请帮我找找第一个错误的出处

||=== MyFirstPro, Debug ===|
\c\MyFirstPro\main.c|28|error: expected ';', ',' or ')' before '&' token|
\c\MyFirstPro\main.c|40|error: expected ';', ',' or ')' before '&' token|
\c\MyFirstPro\main.c||In function 'main':|
\c\MyFirstPro\main.c|71|warning: implicit declaration of function 'InitList_Sq'|
\c\MyFirstPro\main.c|72|error: 'for' loop initial declarations are only allowed in C99 mode|
\c\MyFirstPro\main.c|72|note: use option -std=c99 or -std=gnu99 to compile your code|
\c\MyFirstPro\main.c|75|warning: passing argument 1 of 'scanf' from incompatible pointer type|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\stdio.h|346|note: expected 'const char *' but argument is of type 'ElemType *'|
\c\MyFirstPro\main.c|80|warning: passing argument 1 of 'scanf' from incompatible pointer type|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\stdio.h|346|note: expected 'const char *' but argument is of type 'double *'|
\c\MyFirstPro\main.c|82|warning: implicit declaration of function 'InsertList_Sq'|
\c\MyFirstPro\main.c|84|error: redefinition of 'i'|
\c\MyFirstPro\main.c|72|note: previous definition of 'i' was here|
\c\MyFirstPro\main.c|84|error: 'for' loop initial declarations are only allowed in C99 mode|
\c\MyFirstPro\main.c|86|warning: format '%d' expects type 'int', but argument 2 has type 'ElemType'|
||=== Build finished: 5 errors, 5 warnings ===|
程序无法全部打印上来 这是开头部分 ,,,第一个错误也与开头部分有关,,请帮忙找找

#include<stdio.h>
#include<stdlib.h>

#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2

typedef int Status;

//------------------建立一个数组 该数组存放数值元素---------------------------
#define LISE_INIT_SIZE 100
#define LISEINCERMENT 10

typedef double ElemType;

typedef struct
{
ElemType *elem;
int length;
int listsize;
}SqList;

Status InitList_Sq(SqList &L)
{
L.elem=(ElemType *)malloc(LIST_INIT_SIZE*sizeof(ElemType));
if(!L.elsm)
{
exit(OVERFLOW);
}
L.length=0;
L.listsize=LIST_INIT_SIZE;
return OK;
}

你代码贴错了吧,定义的是LISE_INIT_SIZE 后面用的是LIST_INIT_SIZE,怎么没看到报LIST_INIT_SIZE未定义的错误
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-03-14
#include<stdio.h>
#include<stdlib.h>

#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2

typedef int Status;

//------------------建立一个数组 该数组存放数值元素---------------------------
#define LISE_INIT_SIZE 100
#define LISEINCERMENT 10

typedef double ElemType;

typedef struct
{
ElemType *elem;
int length;
int listsize;
}SqList;

Status InitList_Sq(SqList L)
{
L.elem=(ElemType *)malloc(LISE_INIT_SIZE * sizeof(ElemType)); // LIST_INIT_SIZE
if(!L.elem) // elsm
{
exit(OVERFLOW);
}
L.length=0;
L.listsize=LISE_INIT_SIZE;
return OK;
}

void main()
{
}
第2个回答  2011-03-14
那个ElemType没有定义不能直接用的,你直接用int代替就好了
第3个回答  2011-03-15
meicuoye
相似回答