wcscat() function in C++

The wcscat() function is specified in header file cwchar.h and this function is use to append a copy of wide string to the end of another string.


wchar_t* wcscat( wchar_t* dest, const wchar_t* src );

Parameters: This function takes two parameters:

  • dest: specifies the pointer to the destination array.
  • src: specifies the string to be added to the destination.

Return: This function returns the new appended string.

Below program illustrate the above function:-






// C++ program to demonstrate
// example of wcscat() function.
#include <bits/stdc++.h>
using namespace std;
int main()
    // maximum length of the destination string
    wchar_t dest[30];
    // maximum length of the source string
    wchar_t src[30];
    // initialize the destination string
    wcscpy(dest, L"Geekforgeeks ");
    // initialize the source string
    wcscpy(src, L"is the best");
    wcscat(dest, src);
    wprintf(L"%ls\n", dest);
    return 0;



Geekforgeeks is the best

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.