Question: Programming in C String comparison Write a program compare.c that reads two strings from command line arguments (hint: argc and argv) and outputs using printf

Programming in C

String comparison

Write a program compare.c that reads two strings from command line arguments (hint: argc and argv) and outputs using printf whether one is the reverse of the other while ignoring the case. If the user does not run the program with the correct number of parameters, the program should output an error.

Sample runs of the program are as follows:

>compare Olla allo

The strings are the reverse of each other

>compare CAT tac

The strings are the reverse of each other

>compare Dog dragon

The strings are not the reverse of each other

>compare fog

You must enter two words for comparison. Please try again.

Make sure your code is properly indented, your variables have meaningful names, and macro definitions are used when appropriate.

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!