在VS2008编译C程序错误,但在DevC++编译正确求助?
#include<stdio.h>
#include<stdlib.h>
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int ElemType;
typedef int Status;
typedef struct{
ElemType *elem;
int length;
int listsize;
}SqList;
/*****构造一个空的线性表L*****/
Status IniList_Sq(SqList &L)
{
L.elem=(ElemType *)malloc(LIST_INIT_SIZE*sizeof(ElemType));
if(!L.elem)
exit(ERROR);
L.length=0;
L.listsize=LIST_INIT_SIZE;
return OK;
}
main() {}
为什么这个函数在DevC++编译正确,而在VS2008编译时提示语法错误:缺少")"(在"&"的前面)?
[解决办法]
你这个文件是cpp文件还是.c文件,如果是c程序代码的话,c语言并不支持引用类型必然会出现你说的错误
[解决办法]
引用是C++里面的东西
[解决办法]
引用是C++里面的东西