>>106773939
legal in c23
The context is that I was asking it a style question about
bool leapyear(int year)
{
if (year % 400 == 0)
return 1;
else if (year % 100 == 0)
return 0;
else if (year % 4 == 0)
return 1;
else
return 0;
}
bool leapyear(int year)
{
if (year % 400 == 0)
return 1;
else if (year % 100 == 0)
return 0;
else if (year % 4 == 0)
return 1;
else
return 0;
}
If the common case (mathematically AND, assumed/measured usage statistics) isn't a leap year I want that on the first level. So it reads. returns bool, leapyear, takes an integer year, if cond1, else if cond2, else if cond3, else return 0.
Or in other words, if none of the conditions the programmer considered hold this program returns 0.
Whereas on the second you just know that the program hits an else and exits, implying that you might expect the function to be used in situations wear leap year is more common than expected from random input.