Please answer the question (in terms of C programming) and explain answer. COMP1
ID: 3905933 • Letter: P
Question
Please answer the question (in terms of C programming) and explain answer.
COMP1004 Engineering Question 4 - Arrays and Matrices (20 marks) 04(a) Write a structure in C called 'PASSENGER' to store information about passengers onboard a flight. Include passenger information such as their first name, last name, address, flight number, flight date and seat number. You have to decide which data type to use for these entries 3 marks) lt 04(b) Declare an array of 200 passengers called flight313' using the passenger structure you have created in Q4(a) above. [2 marks] St QHicl Suppose the very first passenger recorded for flight3 13 is called "John Smith", show how you would assign John Smith's first name and last name into the very first element of the flight313 array you have created using your PASSENGER structure from Q4(b) above. [2 marks)Explanation / Answer
1.
typedef struct{
char firstName[20];//string to store firstName of passenger
char lastName[20];//character array t0 store lastName of Passenger
char address[20];//character array to store address
int flightNumber;//integer to store flightnumber
char flightDate[20];//character array to flight data
int searNumber;//integer to store seat number
} PASSENGER;//declare this structure as PASSENGER
2. PASSENGER flight313[200]; //Declare PASSENGER array of size 200
3. flight313[0].firstName="John";//store john in first name of index 0 as he is the first
flight313[0].lastName="Smith";//store john in Smith name of index 0 as he is the first