![]() |
![]() |
![]() |
C++ Reference: strcat()
strcat()
Declaration
char* strcat(char* cpDest, const char* kcpSrc);
Description
This function appends the null-terminated string "kcpSrc" to the null-terminated string "cpDest" with result being stored in "cpDest." The function returns the pointer "cpDest."
Example
#include <cstdio>
#include <cstring>
int main()
{
char caSource[] = ".net";
// Allocate enough room for concatenation
char caDest[10] = "XoaX";
// The two strings before concatenation
printf("%s + %s = ", caDest, caSource);
strcat(caDest, caSource);
// The destination string after concatenation
printf(" %s\n", caDest);
return 0;
}
Output:
![]() |
![]() |
![]() |
| Home | | | Reference | | | Play Games! | | | Blog | | | Forum | | | Site Map | | | Contact Us |





