Question: 1 . Write a program containing three . c files, with the following filenames: name . c , name _ reverse.c and name _ length.c
Write a program containing three c files, with the following filenames: namecnamereverse.c and namelength.c and two h files: namereverse.h and namelength.h and do the following.
a The file namec 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 Middlenames 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: reverseorder and lettercount 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 namereverse.c will contain the definition of the function reverseorder where the signature of the function will be declared in the namereverse.h file. In the definition of the reverseorder function ie 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, namelength.c will contain the definition of the function lettercount where the signature of the function will be declared in the namelength.h file. In the definition of the lettercount count the number of letters in your full name ie 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
