The mbsinit() is an inbuilt function in C++ which is used to check whether ps(passed as a parameter to this function) points to a mbstate_t object that describes an initial conversion state. This function returns non-zero for any mbstate_t object representing an initial state, or if ps is a null pointer.
The state pointed by ps can be set to the initial state by calling :
// ps points now to a zero-valued object memset (ps, 0, sizeof(*ps));
int mbsinit( const mbstate_t* ps)
Parameter : The function accepts one parameter as described below:
- ps :Pointer to an mbstate_t object
Return Value : The function returns two value as follows:
- 0 if ps is not a null pointer and doesn’t represent the initial conversion state.
- Nonzero if ps is a null pointer or represents the initial conversion state.
Below programs illustrate the above function:
Program 1 :
The conversion state is initial conversion state The conversion state is not initial conversion state
Program 2 :
After ps is initialized, the conversion state is initial conversion state After performing some task, the conversion state is initial conversion state
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Difference between user defined function and library function in C/C++
- Function Overloading vs Function Overriding in C++
- How to call some function before main() function in C++?
- How to call function within function in C or C++
- What happens when a virtual function is called inside a non-virtual function in C++
- Difference between Virtual function and Pure virtual function in C++
- log() function in C++
- exp() function C++
- div() function in C++
- fma() function in C++
- bit_and function in C++
- c16rtomb() function in C/C++
- wcspbrk() function in C/C++
- wcsrchr() function in C/C++
- mbrtowc() function in C/C++
- c32rtomb() function in C/C++
- mbrlen() function in C/C++
- wcsncat() function in C/C++
- wcsncmp() function in C/C++
- wcsrtombs() function in C/C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.