Hàm Strcpy

Description

The C library function char *strcpy(char *dest, const char *src) copies the string pointed to, by src khổng lồ dest.

Bạn đang xem: Hàm strcpy

Declaration

Following is the declaration for strcpy() function.

char *strcpy(char *dest, const char *src)

Parameters

dest − This is the pointer to lớn the destination array where the content is khổng lồ be copied.

Xem thêm: #Ca Sĩ Hari Won Là Ai? Wiki Profile Tiểu Sử Mới Nhất 2020 Tiểu Sử Hari Won

src − This is the string khổng lồ be copied.

Return Value

This returns a pointer khổng lồ the destination string dest.

Example

The following example shows the usage of strcpy() function.


Live Demo

#include #include int main () char src<40>; char dest<100>; memset(dest, "", sizeof(dest)); strcpy(src, "This is diywkfbv.com"); strcpy(dest, src); printf("Final copied string : %s ", dest); return(0);Let us compile và run the above program that will produce the following result −

Final copied string : This is diywkfbv.com
string_h.htm

Useful video Courses


*

Video
JCL Online Training 12 Lectures 2 hours

Nishant Malik


More Detail
*

Video
COBOL Online Training

12 Lectures 2.5 hours

Nishant Malik


More Detail
*

Video
CRO Online Training

48 Lectures 6.5 hours

Asif Hussain


More Detail
*

Video
Customer Service Online Training

12 Lectures 2 hours

Richa Maheshwari


More Detail
*

Video
Cultivation of Crops

20 Lectures 3.5 hours

Vandana Annavaram


More Detail
Video
Eclipse Online Training

44 Lectures 1 hours

Amit Diwan


More Detail
Previous Page Print Page
Next Page
Advertisements
Save Close


Dashboard
Logout

We make use of cookies lớn improve our user experience. By using this website, you agree with our Cookies Policy. Agree Learn more