Could someone give me a hint as to why this isn't compiling? I get told that the are 'too many arguments to function howManyDays'. I cant see what i'm doing wrong, i've checked all the online guides i can and it looks to me like im doing the right thing (although im clearly not).
As always, i'm thankful for any help
Code:
#include <stdio.h>
int howManyDays ( int result ); //declare numDays function
int main () //Start of main function
{
int toMonth, fromMonth;
int numDays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
printf ("This program will tell you the number of days from the start of one month to the end of another\n");
printf ("Enter the nmumber of the months you wish to use (Jan=1, Feb=2 etc..): ");
scanf("%d%d", &fromMonth, &toMonth);
printf ("The total number of days is %d\n", howManyDays( fromMonth, toMonth ) ); // sends values for from/toMonth to numDays
return 0;
} //main function ends
int howManyDays( fromMonth, toMonth ) { //numDays function
if (fromMonth < 0 || fromMonth > 11 || toMonth < 0 || toMonth > 11)
printf("Error [-1]. Please check the input...\n");
else
{
int numDays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int count, result=0;
for (count=fromMonth; count <= toMonth; count++)
result += numDays[count];
return result; //result sent to main
}