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 null-terminated wide-character string to be converted.
Pointer to a pointer to a wide character. It is set to the character in `nptr` where the conversion stopped.
Read more about parameters of wcstof in parameters section
The wcstoffunction in C language Converts the initial portion of a wide character string to a floating-point number.
wcstof converts the initial portion of the wide-character string pointed to by nptr to float representation. It's similar to wcstod, but returns a float instead of a double.
The wcstoffunction takes 2
parameters:
•
const wchar_t * `nptr`: Pointer to the null-terminated wide-character string to be converted.
•
wchar_t ** `endptr`: Pointer to a pointer to a wide character. It is set to the character in `nptr` where the conversion stopped.
Converts the initial part of the wide-character string `nptr` to a `float` value. If `endptr` is not `NULL`, it points to the first character after the number that was converted.
The wcstof function return value :
Returns the converted float value
If no conversion could be performed, 0
0f is returned
If the correct value is outside the range of representable values, ±HUGE_VALF is returned with the proper sign, and errno is set to ERANGE
Output
This example demonstrates the basic usage of wcstof to convert a wide string to a float value.