The compiler is giving me an error message on
line 20: "static declaration of ‘timeDifference’ follows non-static declaration"
and then another one on
line 12: "previous declaration of ‘timeDifference’ was here"
I know it has something to do with my function 'timeDifference'. Here is my code:
#include <stdio.h>
struct time
{
int hours;
int minutes;
int seconds;
};
main ()
{
int timeDifference (struct time diff);
struct time early, late, difference;
printf ("Enter Start Time hh:mm:ss ");
scanf ("%d:%d:%d", &early.hours, &early.minutes, &early.seconds);
printf ("Enter End Time hh:mm:ss ");
scanf ("%d:%d:%d", &late.hours, &late.minutes, &late.seconds);
int timeDifference (struct time diff)
{
if (late.seconds < early.seconds)
late.seconds += 60;
late.minutes -= 1;
if (late.minutes < early.minutes)
late.minutes += 60;
late.hours -= 1;
if (late.hours < early.hours)
late.hours += 24;
diff.seconds = late.seconds - early.seconds;
diff.minutes = late.minutes - early.minutes;
diff.hours = late.hours - early.hours;
}
return 0;
}