c-thumb

Compare two Strings in C Language!

In this post, you will learn how to compare two strings using C language. There is a function strcmp() available in core C. It accepts two string parameters and returns an integer value and if the value is 0 then both the strings are equal otherwise not equal.

Let’s see the C program to compare two strings using strcmp(str1, str2):

Sample Output of the above program is:

I hope this would have helped you to learn how to compare strings using C language.

Related Posts

Leave a Reply