在这个简单的程序中,要查找数字是偶数还是奇数,它会不断出现错误 Main.c:3:9: error: Expected '=', ',', ';', 'asm' or '< “{”标记之前的“strong>属性”。请帮忙。
#include<stdio.h>
int main{
int n;
scanf("%d",&n);
if(n%2==0)
printf("%d is an even number",n);
else
printf("%d is an odd number",n);
return 0;
}
最佳答案
由于您在声明 main
时省略了 ()
,编译器认为您正在声明一个变量,因此错误消息中表达了困惑。
关于c - Main.c :3:9: error: expected ‘=’ , ‘,’ 、 ‘;’ 、 ‘asm’ 或 ‘__attribute__’ 位于 ‘{’ token 之前,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55419322/