Next Previous Contents

## 3.143 strcpy

> Function

>   Copy a string.

> Header

>   `string.h`

> Declaration

>   `char* __fastcall__ strcpy (char* s1, const char* s2);`

> Description

>   The `strcpy` function copies the string pointed to by `s2` (including the terminating null byte) into the array pointed to by `s1`. The function will always return `s1`.

> Limits

>   - The function is only available as fastcall function, so it may only be used in presence of a prototype.
>   - If copying takes place between objects that overlap, the behaviour is undefined.
> Availability

>   ISO 9899

> See also

>   strcat, strncat, strncpy

> Example

>       #include <string.h>

>       static char hello[14];

>       strcpy (hello, "Hello world!\n");

Next Previous Contents