C String Function : strcat()

The strcat() function is used to concatenate(combine) two strings. It basically concatenates source string at the end of destination string. The syntax for strcat() is as follows :
char * strcat ( char * destination, const char * source );
Example :
strcat(str1, str2);
The above statement concatenates the str1 at the end of str2 and returns atr1 as a new concatenated string.

Example C Program :
#include <stdio.h>
#include <string.h>

int main() {
  char str1[] = "Hello world.";
  char str2[] = "This is String.";

  strcat(str1, str2);
  printf("%s\n", str1);
  return 0;
Output :

Hello world.This is String.

Note : We have to include the string.h header in our program to use the string function.

Links :