strcpy() — Copy String

Format

#include <string.h>

char *strcpy(char * __restrict__string1, const char * __restrict__string2);

General Description

The strcpy() built-in function copies string2, including the ending NULL character, to the location specified by string1. The string2 argument to strcpy() must contain a NULL character (\0) marking the end of the string. You cannot use a literal string for a string1 value, although string2 may be a literal string. If the two objects overlap, the behavior is undefined.

Returned Value

The strcpy() function returns the value of string1.

Related Information