C strcpy() Function

Last Updated:

C strcpy()

The strcpy() function copies a string from source to destination.

Example

C Compiler
#include <stdio.h> #include <string.h> int main() { char mail[] = "johndoe@gmail.com"; char copyMail[50] = ""; strcpy(copyMail, mail); printf("copyMail is: %s", copyMail); return 0; }

Syntax

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

Parameter Values

ValueTypeExplanation
dest Required Specifies the destination string.
src Required Specifies the source string.

Return Value

ValueExplanation
String Returns the copied string.

Share this Page

Meet the Author