strcat
From cppreference.com
Template:ddcl list begin <tr class="t-dsc-header">
<td>Defined in header
</td>
<string.h>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td >char *strcat( char *dest, const char *src );
</td>
<td class="t-dcl-nopad"> </td> <td > (until C99) </td> </tr> <tr class="t-dcl ">
<td >char *strcat( char *restrict dest, const char *restrict src );
</td>
<td class="t-dcl-nopad"> </td> <td > (since C99) </td> </tr> Template:ddcl list end
Appends a byte string pointed to by src
to a byte string pointed to by dest
. The resulting byte string is null-terminated. If the strings overlap, the behavior is undefined.
Contents |
Parameters
dest | - | pointer to the null-terminated byte string to append to |
src | - | pointer to the null-terminated byte string to copy from |
Return value
dest
Example
Run this code
#include <string.h> // for strcat() #include <stdio.h> // for printf() int main() { char str1[50] = "Hello "; char str2[50] = "World!"; strcat(str1, str2); printf("%s\n", str1); }
Output:
Hello World!
See also
C++ documentation for strcat
|