strcmp

Example: strcmpString Manipulation Functions

Compares string1 and string2 to determine the alphabetic order.

int strcmp( constchar *string1, const char *string2 );

string1 The first string that is compared.
string2 The second string that is compared.

Return Values

Returns a value indicating the lexicographical relation between the strings:

Return value Description
<0 string1 is less than string2
0 string1 is the same as string2
>0 string1 is greater than string2