The strcmp() function is part of the standard C library ( string. h ).
Its primary purpose is to compare the characters of the two strings in sequence until it finds a mismatch or until the end of the strings is reached (that is, the null character '\0').
To compare two strings in C, you can use the strcmp function from the library.
Here's a simple example:
Program.c
Output:
Strings are not equal.
This program compares the content of str1 and str2 using strcmp. If the result is 0, the strings are equal; otherwise, they are not.
Note that strcmp is case-sensitive. If you need a case-insensitive comparison, you can use stricmp (Windows) or strcasecmp (Unix/Linux).
Resources :
Featured
Special title treatment
With supporting text below as a natural lead-in to additional content.