Question: Modify the below program dealer.c so that the program is split into three source files and two header files. A) Put all functions related to

Modify the below program dealer.c so that the program is split into three source files and two header files.

A) Put all functions related to operations on the list of cars into car.c.

B) Create a header file named car.h that contains struct car declaration and prototypes for the functions in car.c. The header file should enclose the contents of the header file in an #ifndef-#endif pair to protect the file.

C) Put the read_line function in a separate file named readline.c.

D) Create a header file named readline.h that contains a prototype for the read_line function. The header file should enclose the contents of the header file in an #ifndef-#endif pair to protect the file.

E) dealer.c contains the main function.

F) Include appropriate header files in the source files.

2.) Write a makefile to build the program on student cluster. The makefile should contain the following rules:

A) Build readline.o by compiling readline.c.

B) Build car.o by compiling car.c.

C) Build dealer.o by compiling dealer.c

D) Build dealer by linking readline.o, car.o, and dealer.o

Each rule should include the name of the target file, dependencies among files, and the command to be executed. The makefile should name the executable file for the program

dealer.

Modify the below program dealer.c so that the program is split intothree source files and two header files. A) Put all functions relatedto operations on the list of cars into car.c. B) Create aheader file named car.h that contains struct car declaration and prototypes for

7 8 9 10 #include #include #include #include 12 #de fine LEN 30 13 14 struct cart 15 16 17 18 19 20 21 char make [LEN+1] char model [LEN+1] char color[LEN+11 int year: int city mpg: int highway mpg: int quantity: struct car next; 23 24 25 26 struct car* append to list (struct car list); 27 void find car (struct car list); 28 void printList (struct car list); 29 void clearList (struct car list); 30 int read line (char str[],int n); 31 32 struct car temp 34 int main (void) 35 ( 36 char code 37 38 struct car car list-NULL ; 39 printf ("Operation code: a for appending the list In f for finding the car In p for printing the list In q for quit.n") 40 1 for) i 42 printf("Enter operation code: ) 43 44 while (getchar ( ) != " ") 45 46 switch (code) 47 case 'a car_1ist-append to1ist (car 1ist) scanf ("%c", &code) ; 49 case ": find, car (carlist); 50 51 case'p printList (car_list): break: break: break: - 52 53 default: printf ("Illegal codeln") 54 56 57 printf("n") 58 59 60 61

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 Databases Questions!