The wmemcmp() function in C/C++ compare two wide characters. This function compares the first num wide characters of two wide characters pointed by str1 and str2, returns zero if both the strings are equal or different value from zero if they are not.
int wmemcmp (const wchar_t* str1, const wchar_t* str2, size_t num);
- str1: specifies the pointer to the first string.
- str2: specifies the pointer to the second string.
- num: specifies the number of character to be compared.
Return value: This function returns three different values which defines the relationship between two strings:
- Zero: when both strings are equal.
- Positive value: when the first wide character that does not match in both strings has a greater frequency in str1 than in str2.
- Negative value: when first wide character that does not match in both strings has less frequency in str1 than in str2
Below programs illustrate the above function:
wmemcmp comparison: equal
wcsncmp comparison: equal wmemcmp comparison: not equal
- Function Overloading vs Function Overriding in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- fma() function in C++
- div() function in C++
- arc function in C
- log() function in C++
- exp() function C++
- map erase() function in C++ STL
- map emplace_hint() function in C++ STL
- map lower_bound() function in C++ STL
- unordered_multiset end() function in C++ STL
- scalbln() function in C++ STL
- map find() function in C++ STL
- map count() function in C++ STL
- set insert() function in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.