The problem is a simple Go-Back-N protocol, the culprit function was provided by the teacher and I am not allowed to change it:
Start line = 516
Code:
starttimer(int AorB, float increment) /* A or B is trying to start timer */
{
struct event *q;
struct event *evptr;
if (TRACE>2)
printf(" START TIMER: starting timer at %f\n",time);
/* be nice: check to see if timer is already started, if so, then warn */
/* for (q=evlist; q!=NULL && q->next!=NULL; q = q->next) */
for (q=evlist; q!=NULL ; q = q->next)
if ( (q->evtype==TIMER_INTERRUPT && q->eventity==AorB) ) {
printf("Warning: attempt to start a timer that is already started\n");
return;
}
/* create future event for when timer goes off */
evptr = (struct event *)malloc(sizeof(struct event));
evptr->evtime = time + increment;
evptr->evtype = TIMER_INTERRUPT;
evptr->eventity = AorB;
insertevent(evptr);
}
Line = 81
which when I call
Code:
starttimer(0, 50.0);
gives the following errors:
517 C:\Dev-Cpp\Free\prog2.c conflicting types for 'starttimer'
517 C:\Dev-Cpp\Free\prog2.c an argument type that has a default promotion can't match an empty parameter name list declaration
81 C:\Dev-Cpp\Free\prog2.c previous implicit declaration of 'starttimer' was here
I manged to find this trifecta of errors several places on the internet and the general consensus was that it came from trying to call the function before it declaration (makes sense) with the proposed solution of adding a prototype declaration of that function before the function gets called. So I did this:
Line 38
Code:
starttimer(int AorB, float increment);
Which seems to fix the original errors but generates me this shiny new error:
38 C:\Dev-Cpp\Free\prog2.c [Warning] data definition has no type or storage class
Which I can't find anything to in my scouring of the internet and it basically just has me at a loss. I tried declaring it void, I tried different variable names, passing no variables, moving it around a bit but nothing.
If anyone could help I would be forever grateful, I'd have your children but alas no uterus.
Please Help