Question: 1 . Write a program containing three . c files, with the following filenames: name . c , name _ reverse.c and name _ length.c

1. Write a program containing three .c files, with the following filenames: name.c,name_reverse.c and name_length.c and two .h files: name_reverse.h and name_length.h and do the following.
a) The file name.c will contain the main() function. The main() will declare your name as a string variable (char pointer or char array) whose value will be your Firstname Lastname. There should be one or more spaces between the Firstname and Lastname. Note that, if you have one or more Middlename(s), do not use that. Use only two words, the firstname and the lastname, so that the complexity is even for everyone.
Then it should call two functions: reverse_order() and letter_count() where it will pass the string variable as (char *) in both functions. But this file will not contain the definitions of those two functions.
b) The file name_reverse.c will contain the definition of the function reverse_order() where the signature of the function will be declared in the name_reverse.h file. In the definition of the reverse_order() function (i.e., in the .c file) write the logic for reversing the string orders such that it converts the Firstname Lastname to Lastname Firstname and print it.
c) Similarly, name_length.c will contain the definition of the function letter_count() where the signature of the function will be declared in the name_length.h file. In the definition of the letter_count(), count the number of letters in your full name (i.e. firstname and lastname without spaces). Print the letter counts as the length of your name.
d) Write a Makefile for compilation of these files (three .c and two .h files) and run the make command to compile to generate the executable. Show screenshot of compilation as well.
e) Run the executable and take screenshot of the output from the terminal.

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!