C strcoll()

The strcoll() function compares the string pointed to by str1 with the one pointed to by str2. The comparison is performed in accordance with the locale specified using the setlocale() function.

The strcoll() function returns an integer that is interpreted as indicated here in the following table :

Value Meaning
Less than zero str1 is less than str2
Zero str1 is equal to str2
Greater than zero str1 is greater than str2

strcoll() Syntax

Following is the syntax of the strcoll() function :

int strcoll(const char *str1, const char *str2);

strcoll() Example

Following code fragment prints Equal on the screen :

if(strcoll("hi", "hi"))

C Online Test

« Previous Chapter Next Function »

Like/Share Us on Facebook 😋