Home >>C String functions >C strcpy() function
Strcpy() function copy contents of one string to another string.
Syntax:Strcpy(str1,str2)
Note:- Here str is given string.
It takes strings as parameter.
It returns modified string.
Example-1
#include <stdio.h>
#include <string.h>
int main( )
{
char source[ ] = "copy the content" ;
char target[20]= "" ;
printf ( "\nsource string = %s", source ) ;
printf ( "\ntarget string = %s", target ) ;
strcpy ( target, source ) ;
printf ( "\ntarget string after strcpy( ) = %s", target ) ;
return 0;
}