So I have Time structure arrays which contain time in hh,mm,ss format. I have made a function timeDifference to calculate difference of time in seconds.
In my function how can I pass the arguments as two time structures?
I'm trying to do something like this and getting implicit declaration of function error;
int timeDifference(struct time T[i], struct time T[j]);
T[i], T[j] could be referencing to two time structures T[0] and T[1] as follows:
struct time{
int hours;
int minutes;
int seconds;
};
int timeDifference(struct time T[i], struct time T[j]);
int main(){
struct time T[8]; // 9 time structures i.e 9 time values in hh,mm,ss
T[0].hours=2;
T[0].minutes= 00; // T[0]
T[0].seconds=00;
T[1].hours=3;
T[1].minutes=10; // T[1]
T[1].seconds=00;
timeDifference(T[0], T[1]); Function call in main for evaluating difference
.
.
.
}
int timeDifference(struct time T[i], struct time T[j]) // function for
// calculating difference
{
.
.
}
I think it uses pointers, I'm new to C hence could anyone suggest any online resources for understanding pointers? Thank You
int timeDifference(struct time a, struct time b)
. Also, make sure the prototype is available tomain()
. – EOF Oct 17 '15 at 22:13