c++ error C2143: syntax error : missing ')' before ';'请您多帮忙
来源:百度知道 编辑:UC知道 时间:2024/06/23 07:41:02
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
typedef int status;
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define STACK_INIT_SIZE 100;
#define STACKINCREMENT 10;
typedef struct{
int *base;
int *top;
int stacksize;
}sqstack;
status initstack(sqstack &s)
{
s.base=(int *)malloc( STACK_INIT_SIZE * sizeof(int));//这行报错
if(!s.base){
puts("Can't allocate memory");
exit(1);
}
s.top=s.base;
s.stacksize=STACK_INIT_SIZE;
return OK;
}
status push(sqstack &s,int e)
{
if(s.top - s.base >= s.stacksize){
s.base=(int *)realloc(s.base,(s.stacksize+STACKINCREMENT)*sizeof(int));//这行报错
if(!s.base){
puts("Can't allocate memory");
exit(1);
}<
#include <stdio.h>
#include <stdlib.h>
typedef int status;
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
#define STACK_INIT_SIZE 100;
#define STACKINCREMENT 10;
typedef struct{
int *base;
int *top;
int stacksize;
}sqstack;
status initstack(sqstack &s)
{
s.base=(int *)malloc( STACK_INIT_SIZE * sizeof(int));//这行报错
if(!s.base){
puts("Can't allocate memory");
exit(1);
}
s.top=s.base;
s.stacksize=STACK_INIT_SIZE;
return OK;
}
status push(sqstack &s,int e)
{
if(s.top - s.base >= s.stacksize){
s.base=(int *)realloc(s.base,(s.stacksize+STACKINCREMENT)*sizeof(int));//这行报错
if(!s.base){
puts("Can't allocate memory");
exit(1);
}<
#define STACK_INIT_SIZE 100;
#define STACKINCREMENT 10;
改为
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
(即去掉结尾的分号)
26|error: expected primary-expression before "int"
的确,如果不去掉分号
s.base=(int *)malloc( STACK_INIT_SIZE * sizeof(int));//这行报错
就被替换为:
s.base=(int *)malloc( 100; * sizeof(int));//这行报错
提前加了一个语句结束符号;
#define STACK_INIT_SIZE 100;
#define STACKINCREMENT 10;
//这两行后面的分号去掉,宏定义没这么用的
error:rumtime error 204 at 0040249C
C语言declaration syntax error
Data error reading drive C
C程序出错:error C2059: syntax error : '{'
c语言问题:error C2059: syntax error : ']'
倾家荡产求助:“C语言 declaration syntax error”
Ruantime error 183 at 0440385C
Data error reading drive C.是什么意思?
runtime error at 0040249C 204
runtime error 204 at 0040249c