strcat() in C Last Updated : 11 Mar, 2023 Comments Improve Suggest changes 41 Likes Like Report C strcat() function appends the string pointed to by src to the end of the string pointed to by dest. It will append a copy of the source string in the destination string. plus a terminating Null character. The initial character of the string(src) overwrites the Null-character present at the end of the string(dest). It is a predefined string handling function under string library <string.h> in c and <cstring> in C++. Syntax: char *strcat(char *dest, const char *src); Parameters: The method accepts the following parameters: dest: This is a pointer to the destination array, which should contain a C string, and should be large enough to contain the concatenated resulting string.src: This is the string to be appended. This should not overlap the destination. Return value: The strcat() function returns dest, the pointer to the destination string. Examples: Input: src = "ForGeeks" dest = "Geeks" Output: "GeeksForGeeks" Input: src = "World" dest = "Hello " Output: "Hello World" Below is the C/C++ program to implement the above approach: C // C program to implement // the above approach #include <stdio.h> #include <string.h> // Driver code int main() { // Define a temporary variable char example[100]; // Copy the first string into // the variable strcpy(example, "Geeks"); // Concatenate this string // to the end of the first one strcat(example, "ForGeeks"); // Display the concatenated strings printf("%s\n", example); return 0; } OutputGeeksForGeeksThe behavior of strcat() is undefined if:the destination array is not large enough for the contents of both src and dest and the terminating null characterif the string overlaps.if either dest or src is not a pointer to a null-terminated byte string. Comment D dhanshreekulkarni21 Follow 41 Improve D dhanshreekulkarni21 Follow 41 Improve Article Tags : C Language TrueGeek-2021 CPP-Functions C-String C-Functions cpp-strings-library +2 More Explore C BasicsC Language Introduction6 min readIdentifiers in C3 min readKeywords in C2 min readVariables in C4 min readData Types in C3 min readOperators in C8 min readDecision Making in C (if , if..else, Nested if, if-else-if )7 min readLoops in C6 min readFunctions in C5 min readArrays & StringsArrays in C4 min readStrings in C5 min readPointers and StructuresPointers in C7 min readFunction Pointer in C6 min readUnions in C3 min readEnumeration (or enum) in C5 min readStructure Member Alignment, Padding and Data Packing8 min readMemory ManagementMemory Layout of C Programs5 min readDynamic Memory Allocation in C7 min readWhat is Memory Leak? How can we avoid?2 min readFile & Error HandlingFile Handling in C11 min readRead/Write Structure From/to a File in C3 min readError Handling in C8 min readUsing goto for Exception Handling in C4 min readError Handling During File Operations in C5 min readAdvanced ConceptsVariadic Functions in C5 min readSignals in C language5 min readSocket Programming in C8 min read_Generics Keyword in C3 min readMultithreading in C9 min read Like