C String Compare
In this section, you will learn how to compare two strings. You can see in the given example, the program prompts the user to enter the two strings one by one. The library function gets() get the entered string from the console. The function strlen() determines the length of the strings and the function strcmp() compares the strings on the basis of length.
Here is the code:
COMPARES.C
#include <string.h>
|
Output will be displayed as:
COMPARES.EXE