Introduction
The article covers the implementation of wascat() method In C++, the wcscat() method copies a wide string and appends it to the end of another wide string. In the <cwchar> header file, the wcscat() method is defined. You can think it as a concatination method for wide characters.
There is a popular quote “Don’t talk, just show me the code!!” abiding by the words let see the implementation of the wcscat() in C++.
Also see, Literals in C, Fibonacci Series in C++
BreakDown of wcscat() method
The section discusses the detailed breakdown of the wcscat() method in C++. It includes discussion of declaring the prototype, parameters of wcscat() and return value of the wcscat() method.
Prototype declaration wcscat()
wchar_t* wcscat(wchar_t* dest, const wchar_t* src);
The dest and src inputs are sent to the wcscat() method. This function appends a duplicate of src's wide character string to the end of dest's wide character string.
The first character of src replaces the null ending wide character at the end of dest, and the new character is also null terminated.
If the behaviour isn't defined,
1. The strings overlap.
2. The dest array is too small to accommodate the contents of src.
Parameters of wcscat()
dest: Pointer to a null terminating wide string to append to.
src: Pointer to a null terminating wide string that is to be appended.
Return value of wcscat()
The wcscat() function returns the dest pointer.
Also Read - C++ Interview Questions