Skip to content
Related Articles

Related Articles

Improve Article

wcscat() function in C++

  • Difficulty Level : Easy
  • Last Updated : 01 Oct, 2018

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.

Syntax:

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:-

Example:-




// 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;
}
Output:
Geekforgeeks is the best
Want to learn from the best curated videos and practice problems, check out the C++ Foundation Course for Basic to Advanced C++ and C++ STL Course for foundation plus STL.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.
My Personal Notes arrow_drop_up
Recommended Articles
Page :