Isn't code at line 2 correct?
a.c:2: warning: suggest parentheses around && within ||
int isleap(int year){
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) /*line
2*/
return 1;
return 0;
}
&& binds more tightly than ||, so the test is equivilent to
(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
However, it is relatively common for people to mistakenly think of
&& and || as having the same precedences, and so it is common
for people to read the operators from left to right. It doesn't
make a difference in this particular case, but if you had written,
if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0)
then people would tend to (mistakenly) read this as
if ((year % 400 == 0 || year % 4 == 0) && year % 100 != 0)
when really it is
if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
The warning is altering you to the possibility of the common misreading.