I have to use arrays for this projects and I only understand the basics of arrays. I have no clue how to implement it into the loop and am stuck right now. Oh yeah, I did a search and couldn't find a similar topic.

I am given a set of departure and arrival times. A user is suppose to enter a 24-hour time and then the program displays the closest departure time out of the given times that are available.

This is an example output.

Enter a 24-hour time: 13:15
You entered 13:15
Closest departure time is 12:47 p.m., arriving at 3:00 p.m.
This is the code I have gotten so far. It's only the beginning so far.

Code:
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int departure_times[] = 
		{8*60, 9*60+43, 11*60+19, 12*60+47, 
         14*60, 15*60+45, 19*60, 21*60+45};

    int arrival_times[] =
        { 10*60+16, 11*60+52, 13*60+31, 15*60,
          16*60+8, 17*60+55, 21*60+20, 23*60+58};

		  
    int i, hour, minute;
	

	printf("Enter a 24-hour time: ");
	scanf("%d:%d", &hour, &minute);

	printf("You entered %d:%d\n", hour, minute);

	
    for (i = 0; i < minute; i++)
    {
		hour = hour * 60;
		minute = minute + hour;
		
		i++
	}
	
	

    getchar();
    getchar();
    return 0;
}
The problem I'm having is implementing the array inside the loop. I'm thinking about using a for loop instead of a while loop. The program is suppose to search inside this loop to find the closest departure time. I would like to ask for some tips to get me started on the loop, or examples.

Thanks.

Almost forgot, I am suppose to use the abs() function in this program, but I also have no clue on how to implement this. It's suppose to be used with what the user inputs as time since it could be before or after the closest time.