On codecademy there exists a course on C, which includes a project on how to make a calendar. This project includes a boolean function which decides if a given year is a leap year or not. Code:
bool is_leap_year(int year) {
return (year % 4 == 0 && (year % 100 || year % 400 == 0));
}
Given my beginner understanding of operators and return statements, my reading of this code would be: "A given year will be a leap year if it is divisible by 4 AND 100 OR 400." But this would mean that 1992 wouldn't be a leap year, and 1900 would be, which is plainly wrong.
How come then, that when I run the code and input these years, it does return a correct answer?