CodesJava

Easy learning with example program codes

C strcpy()


C strcpy():

String Functions are the built-in functions provided by C to operate and manipulate a string. C strcpy() function copies a string from source to destination.

Syntax: 

strcpy(destination, source)

Example:

#include<stdio.h>  
#include <string.h>  
#include <stdbool.h>
 
void main()
{    
char str1[10] = "Hello C.";  
char str2[10];
 
strcpy(str2, str1);
puts(str2);
}

Output

Hello C.
Posted in C   
Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki