Error- 'determineDay' : local function definitions are illegal

I have no idea what this error means. This is a snippet of code from my larger program which includes other functions and a main. I just rewrote this code again and I'm still getting the same error. What did I do wrong?



int determineDay(int month, int day, int year) {

const int HUNDRED_YEARS = 100;
int newYear = year % HUNDRED_YEARS;
int century = (year - newYear) / HUNDRED_YEARS;


if (month == 1) {
const int ONE_YEAR = 1;
month = 13;
year = year - ONE_YEAR;
int zellerNumber = (day + floor((13 * (month + 1)) / 5)) + year
+ floor(year / 4) + floor(century / 4) + 5 * century) % 7;

}
else if (month == 2) {
const int ONE_YEAR = 1;
month = 14;
year = year - ONE_YEAR;
int zellerNumber = (day + floor((13 * (month + 1)) / 5)) + year
+ floor(year / 4) + floor(century / 4) + 5 * century) % 7;
}

else {
int zellerNumber = (day + floor((13 * (month + 1)) / 5)) + year
+ floor(year / 4) + floor(century / 4) + 5 * century) % 7;
}


return zellerNumber;
}
Topic archived. No new replies allowed.