Namespaces
Variants
Views
Actions

Difference between revisions of "c/string/byte/strcpy"

From cppreference.com
< c‎ | string‎ | byte
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pt, zh)
(+restrict variant)
Line 1: Line 1:
 
{{c/title| strcpy}}
 
{{c/title| strcpy}}
 
{{c/string/byte/navbar}}
 
{{c/string/byte/navbar}}
{{ddcl | header=string.h |
+
{{ddcl list begin}}
char *strcpy( char *dest, const char *src );
+
{{ddcl list header | string.h}}
 +
{{ddcl list item | notes={{mark until c99}} |
 +
char *strcpy( char         *dest, const char         *src );
 
}}
 
}}
 +
{{ddcl list item | notes={{mark since c99}} |
 +
char *strcpy( char *restrict dest, const char *restrict src );
 +
}}
 +
{{ddcl list end}}
  
 
Copies the byte string pointed to by {{tt|src}} to byte string, pointed to by {{tt|dest}}.
 
Copies the byte string pointed to by {{tt|src}} to byte string, pointed to by {{tt|dest}}.

Revision as of 12:48, 10 April 2013

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <string.h>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
char *strcpy( char          *dest, const char          *src );
</td>

<td class="t-dcl-nopad"> </td> <td > (until C99) </td> </tr> <tr class="t-dcl ">

<td >
char *strcpy( char *restrict dest, const char *restrict src );
</td>

<td class="t-dcl-nopad"> </td> <td > (since C99) </td> </tr> Template:ddcl list end

Copies the byte string pointed to by src to byte string, pointed to by dest.

If the strings overlap, the behavior is undefined.

Contents

Parameters

dest - pointer to the byte string to copy to
src - pointer to the null-terminated byte string to copy from

Return value

dest

Example

See also

Template:c/string/byte/dcl list strncpyTemplate:c/string/byte/dcl list memcpy