| functions/days-month-leap-multiple-return.c - Funktionen daysInMonth - med multiple return. | Lektion 6 - slide 3 : 21 Program 2 |
int daysInMonth(int month, int year){
switch(month){
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
return 31;
case 4: case 6: case 9: case 11:
return 30;
case 2:
if (isLeapYear(year))
return 29;
else
return 28;
default:
return ERROR_VALUE;
}
}