Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

The Strcoll ()() Function in C

Explore The Strcoll ()() Function in C with clear explanations, practical examples, and useful tips.

Table of Contents

This guide covers the strcoll ()() function in c with practical context and easy-to-follow details. Use it to understand the subject and apply the information confidently.

Declaring the Strcoll ()() Function in C

Here is the declaration for strcoll () in C:

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

Parameters

Str1 - This is the first string to be compared.

Str2 - This is the second string to be compared.

Returns the Value

This function returns the following values:

If the value returns <0, this function indicates that str1 is shorter than str2.

If the value returns> 0, this function indicates that str2 is shorter than str1.

If the return value = 0, this function indicates that str1 is equal to str2.

For Example

The following C program illustrates the usage of strcoll () in C:

 #include #include int main () { char str1 [ 15 ]; char str2 [ 15 ]; int ret ; strcpy ( str1 , "abc" ); strcpy ( str2 , "ABC" ); ret = strcoll ( str1 , str2 ); if ( ret > 0 ) { printf ( "Chuoi str1 la ngan hon chuoi str2" ); } else if ( ret < 0 ) { printf ( "Chuoi str2 la ngan hon chuoi str1" ); } else { printf ( "Chuoi str1 la bang chuoi str2" ); } return ( 0 ); } 

Compiling and running the above C program will result:

According to Tutorialspoint

Previous article: Function strncmp () in C

Next lesson: strcpy () function in C

FAQ

What should I check before following these steps?

Confirm device and software compatibility, save important data, and make sure you have the required permissions, files, and account access.

Why might the process not work?

Common causes include outdated software, missing permissions, incompatible hardware, an unstable connection, or completing a step in the wrong order.

Can I undo the changes if necessary?

That depends on the tool or setting. Use built-in restore options when available, keep a backup, and record the original configuration first.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.