strcat C Library Function

The function char *strcat(char *destination, const char *source); appends string pointed by source at the end of string pointed by destination. It will overwrite null character of destination and append a null character at the end of combined string. Destination string should be large enough to contain the concatenated string.

Function prototype of strcat

char *strcat(char *destination, const char *source);
  • destination : This is pointer to destination array(containing a null terminated string) where we want to append another string.
  • source : It is a pointer to a string to be appended. This should not overlap destination.

Return value of strcat

It returns a pointer to destination string.

C program using strcat function

The following program shows the use of strcat function to append one string at the end of another string.

#include <stdio.h>
#include <string.h>
#include <conio.h>

int main()
   char stringOne[100], stringTwo[100];

   printf("Enter first string\n");
   printf("Enter second string\n");
   strcat(stringTwo, stringOne);
   printf("Second string after strcat\n%s", stringTwo);


Enter first string
Enter second string
Second string after strcat