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:
Output will be displayed as:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: February 6, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles