代码24行出现 non-lvalue in assignment

问题描述:

代码24行出现 non-lvalue in assignment
#include
#define IS(x)x%100!=0&&x%4=0||x%400=0?1:0
int dayofmonth[13][2]={
0,0,
31,31,
28,29,
31,31,
30,30,
31,31,
30,30,
31,31,
31,31,
30,30,
31,31,
30,30,
31,31,
};
struct Date {
int year;
int month;
int day;
void nextday(){
day++;
if(day>dayofmonth[month][IS(year)]){ // 该行错误
day=1;
month++;
if(month>12){
month=1;
year++;
}
}
}
};
int buf[4000][13][32];
int abs(int x){
return x>0?-x:x;
}
int main(){
int i=0;
Date tem;
tem.year=0;
tem.day=1;
tem.month=1;
while(tem.year!=4001){
buf[tem.year][tem.month][tem.day]=i;
tem.nextday();
i++;
}
int d1,d2,d3;
int d4,d5,d6;
scanf("%4d%2d%2d",d1,d2,d3);
scanf("%4d%2d%2d",d4,d5,d6);
printf("%d",abs(buf[d4][d5][d6]-buf[d1][d2][d3])+1);
return 0;
}

典型的新手错误
C语言中判断两个变量是否相等不是用"=",要用"=="
把代码第二行改成:#define IS(x)x%100!=0&&x%4==0||x%400==0?1:0
编译就通过了