东莞高端网站建设多少钱,凡科网站备案,小程序在哪里,上海市网站制作我们在运行C程序的时候经常会遇到错误#xff0c;如果你遇到了这个错误#xff1a;error C2143: syntax error : missing ‘;’ before ‘}’#xff0c;那麽我将帮你解决这个错误。
错误展示 完整代码
#include stdio.h
#define exchange(a,b){int t; ta;ab;bt}
…我们在运行C程序的时候经常会遇到错误如果你遇到了这个错误error C2143: syntax error : missing ‘;’ before ‘}’那麽我将帮你解决这个错误。
错误展示 完整代码
#include stdio.h
#define exchange(a,b){int t; ta;ab;bt}
int main()
{int x 100;int y 200;printf(x%d; y%d\n,x,y);exchange(x,y);printf(x%d; y%d\n,x,y);return 0;
}出现上述错误是因为我们在类的前面少了一个冒号我们只需要在类的前面加上一个就可以了。
加上 ; 之后的代码
#include stdio.h
#define exchange(a,b){int t; ta;ab;bt;}
int main()
{int x 100;int y 200;printf(x%d; y%d\n,x,y);exchange(x,y);printf(x%d; y%d\n,x,y);return 0;
}运行输出 程序已经编译完成原来的错误信息已经消失。