A pointer to a wide-character string, where each element is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets.
A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.
1st Parameter
Pointer to the beginning of the wide-character array to be searched.
2nd Parameter Type : wchar_t
A data type used to represent wide characters, typically supporting larger character sets such as Unicode. Its size is platform-dependent but is often 2 or 4 bytes.
2nd Parameter
The wide character to search for in the array.
3rd Parameter Type : size_t
Platform-specific unsigned type for array indices and memory sizes.
3rd Parameter
The number of elements in the array to search.
Read more about parameters of wmemchr in parameters section
The wmemchrfunction in C language Searches for a wide character in the first 'n' wide characters of a wide character array.
wmemchr searches for the first occurrence of the wide character 'c' in the first 'n' wide characters of the object pointed to by 's'. This function operates on raw memory and doesn't stop at null terminators.
The wmemchrfunction takes 3
parameters:
•
const wchar_t * `ptr`: Pointer to the beginning of the wide-character array to be searched.
•
wchar_t `wc`: The wide character to search for in the array.
•
size_t `n`: The number of elements in the array to search.
Searches the first `n` elements of the wide-character array pointed to by `ptr` for the first occurrence of the wide character `wc`. Returns a pointer to the matching wide character, or `NULL` if the character is not found within the specified range.
The wmemchr function return value :
Returns a pointer to the located wide character, or NULL if the wide character does not occur in the object
Output
This example demonstrates the basic usage of wmemchr to find a character in a wide character string.