The wcscpy() function is defined in cwchar.h header file. The wcscpy() function is used to copy a wide character string from source to destination.
Syntax:
wchar_t *wcscpy(wchar_t *dest, const wchar_t *src);
Parameters: This method accepts the following two parameters:
- dest: specifies the pointer to the destination array.
- src: specifies the pointer to the source array.
Return Value: The wcscpy() function returns the modified destination.
Below program illustrate the above function:-
Example:-
#include <bits/stdc++.h>
using namespace std;
int main()
{
wchar_t dest[40];
wchar_t src[]=L "A computer science portal for geeks" ;
wcout << L "Source: " << src << endl;
wcout << L "Destination: " << dest << endl;
wcscpy(dest, src);
wcout << L "After modification, destination: " << dest;
return 0;
}
|
Output:
Source: A computer science portal for geeks
Destination:
After modification, destination: A computer science portal for geeks
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
03 Oct, 2018
Like Article
Save Article