Question: in c language. The template code defines a Time struct. Given main ( ) that reads two Times and computes the difference between the two,

in c language. The template code defines a Time struct. Given main() that reads two Times and computes the difference between the two, complete the following two functions:
Time* CreateTime(int hours, int minutes, int seconds)
Allocate and return a new Time according to the parameters
Time* TimeDifference(Time* end, Time* start)
Allocate a new Time to store the computed time difference
Compute the amount of time elapsed from start to end. Assume start is always before end.
Adjust for negative minutes and seconds.
Return the pointer to Time that contains the difference
main() calls ReadTime() to read input from a user and uses the input to create a new Time by calling CreateTime(). PrintTime() is provided to output Time in 24 hour format (hh:mm:ss).
Ex: If the input is:
025510
041550
the output is:
Start: 02:55:10
End: 04:15:50
Difference: 01:20:40

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!