Question: 5. Program Development on Unix ( 23 points total ) First write a new main function and place it in a file called prompt.c .

5. Program Development on Unix (23 points total)

First write a new main function and place it in a file called prompt.c.

The new main function will prompt the user for a string and then use the palindrome function to determine if the string is a palindrome.

NOTE: Function main in file prompt.c will call function palindrome in file palindrome.c. Function palindrome calls function reverse in file reverse.c.

prompt.c should output:

string IS a palindrome

if the string is a palindrome

string is not a palindrome

if it is not a palindrome

Example program run:

Enter a string: dad

dad IS a palindrome

Turn in a listing of your prompt.c source code. (7 points)

Separately compile the reverse.c, palindrome.c, and prompt.c using the either the cc or gcc compiler (whichever is available on your system).

What commands did you use to separately compile? (3 points)

Then link prompt.o with palindrome.o and reverse.o into an executable called runpalin.

What command did you use to link and create the executable? (2 points)

Finally, execute the program. What command did you use? (1 point)

Create a makefile that will separately compile all three files (prompt, palindrome, and reverse) and then link them to create the runpalin executable. Include all dependencies.

Turn in a listing of your make file. (6 points)

Run the touch utility on all .c source code files.

What command did you use? (2 points)

Run the makefile to re-create the runpalin executable file.

What command did you use? (2 points)

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!