Programming Reference/Librarys
Question & Answer
Q&A is closed
The strcat function concatenates two strings.
str1 = target string to be added to source
str2 = source string to copied, including '\ 0' at the end of destination.
null byte of destination will be overwritten.
/* * strcat example code * http://code-reference.com/c/string.h/strcat */ #include <stdio.h> #include <string.h> int main ( void ) { char str[42]="strcpy "; strcat (str,"c example "); printf("%s\n", str); strcat(str, "for c"); printf("%s\n", str); return 0; }
user@host:~$ ./strcat strcpy c example strcpy c example for c