错误 C2143:语法错误:缺少“;"在“类型"之前 [英] error C2143: syntax error : missing ';' before 'type'
本文介绍了错误 C2143:语法错误:缺少“;"在“类型"之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 C 编程新手.. 请告诉我这个程序有什么问题,以及为什么我会收到这个错误:错误 C2143:语法错误:缺少 ';'在类型"之前....
I am new to programming C.. please tell me what is wrong with this program, and why I am getting this error: error C2143: syntax error : missing ';' before 'type'....
extern void func();
int main(int argc, char ** argv){
func();
int i=1;
for(;i<=5; i++) {
register int number = 7;
printf("number is %d
", number++);
}
getch();
}
推荐答案
我至少有 8 年没有使用 Visual,但似乎 Visual 有限的 C 编译器支持不允许混合代码和变量.int i=1;
声明中的错误行是??尝试将其移动到对 func();
I haven't used visual in at least 8 years, but it seems that Visual's limited C compiler support does not allow mixed code and variables. Is the line of the error on the declaration for int i=1;
?? Try moving it above the call to func();
另外,我会使用 extern void func(void);
这篇关于错误 C2143:语法错误:缺少“;"在“类型"之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文