Or login with:
#include <string.h>| int | strcoll (const char *s1, const char *s2) |
| int | strcoll_l (const char *s1, const char *s2, locale_t loc) |
s1 and s2 according to the current locale collation if any, otherwise call strcmp, and returns an integer greater than, equal to, or less than 0, according as s1 is greater than, equal to, or less than s2.
While the strcoll function uses the current locale, the strcoll_l function may be passed a locale directly. See xlocale for more information.
#include <stdio.h> #include <string.h> int main() { // define two strings s, t and initialize s char s[10] = "testing", t[10]; // copy s to t strcpy(t, s); // test if s is identical to t if (!strcoll(s, t)) printf("The strings are identical."); else printf("The strings are different."); return 0; }
The strings are identical.
You must login to leave a messge