R
rick
the following line appears in the K&R book in section 5.7:
leap = year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
my compiler suggests parentheses "around && within ||"
given that the AND operator has higher precedence than OR, would the
correct grouping be this:
leap = (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
?
thanks,
~rick
leap = year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
my compiler suggests parentheses "around && within ||"
given that the AND operator has higher precedence than OR, would the
correct grouping be this:
leap = (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
?
thanks,
~rick