strcat() in C Last Updated : 11 Mar, 2023 Comments Improve Suggest changes Like Article 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 More infoAdvertise with us Next Article strcat() in C D dhanshreekulkarni21 Follow Improve Article Tags : C Language C++ TrueGeek TrueGeek-2021 CPP-Functions C-String C-Functions cpp-strings-library +4 More Practice Tags : CPP Similar Reads strchr in C The strchr() function in C is a predefined function in the <string.h> library. It is used to find the first occurrence of a character in a string. It checks whether the given character is present in the given string. If the character is found, it returns the pointer to its first occurrence oth 3 min read strcpy() in C In C, strcpy() is a built-in function used to copy one string into another. It is a part of the C standard strings library, which provides various functions to manipulate strings efficiently.Let's take a look at an example:C#include <stdio.h> #include <string.h> int main() { char s1[] = 3 min read strrchr() in C The strrchr() function in C locates the last occurrence of a character in a string and returns a pointer to it. It is a standard library function defined inside <string.h> header file. Syntax : char* strrchr( char* str, int chr ); Parameter: str: specifies the pointer to the null-terminated st 2 min read scanf in C In C, scanf() is a function is used to read data from stdin (standard input stream i.e. usually keyboard) and stores the result into the given arguments. It is defined in the <stdio.h> header file.Example:C#include <stdio.h> int main() { int n; // Reading an integer input scanf("%d", 3 min read strcat() Function in C++ The strcat() function in C++ is a predefined function in the <cstring> header file that is used to concatenate two strings, by appending a copy of the source string to the end of the destination string. This function works by adding all the characters till the null character of the source stri 2 min read Strings in C A String in C programming is a sequence of characters terminated with a null character '\0'. The C String is work as an array of characters. The difference between a character array and a C string is that the string in C is terminated with a unique character '\0'.DeclarationDeclaring a string in C i 5 min read snprintf() in C In C, snprintf() function is a standard library function that is used to print the specified string till a specified length in the specified format. It is defined in the <stdio.h> header file.In this article, we will learn about snprintf() function in C and how to use it in our program.SyntaxC 3 min read strcat() vs strncat() in C++ strcat() The strcat() function will append a copy of the source string to the end of destination string. The strcat() function takes two arguments: 1) dest 2) src It will append copy of the source string in the destination string. The terminating character at the end of dest is replaced by the first 3 min read strncat() function in C/C++ In C/C++, strncat() is a predefined function used for string handling. string.h is the header file required for string functions.This function appends not more than n characters from the string pointed to by src to the end of the string pointed to by dest plus a terminating Null-character. The initi 4 min read Like