Problem Overview

An airline company needs a program to help sort its daily flight schedule. Each flight record contains:

Your task is to read N flights from a file, store them in a dynamically allocated array, bubble sort them by departure time (earliest first), and if times are the same, sort by flight number alphabetically.


Sample Input

input.txt:

8
AA123 Dallas 14:30
BA200 London 09:45
DL450 Atlanta 14:30
UA999 Chicago 06:15
AF320 Paris 22:10
QF101 Sydney 05:50
JL720 Tokyo 09:45
LH400 Frankfurt 14:05

Step-by-Step Subtasks

Step 1: Define the Flight Structure

Create a struct to hold flight information:

typedef struct
{
    char flightNumber[10];
    char destination[50];
    char departureTime[6]; // HH:MM format
} Flight;

<aside> 💡

Why these sizes? Flight numbers are typically short (e.g., "AA123"), destinations can be longer city names, and departure time is exactly 5 characters plus null terminator ("HH:MM").

</aside>


Step 2: Read Flights from File

Implement Flight* readFlightsFromFile(char* filename, int* n):

Subtasks: