Concatenation Of A String – C

  • What is string concatenation?
String concatenation
  • String concatenation is appending a string to the other string.
  • It needs to have two arguments say string 1 and string 2.
  • Concatenating will add string 1 to string 2.

  • Let us see how?

str1 = “coder’s space”;

str2 = “prequelcoding”[

now str1 when it is concatenated with str2 produces coder’s space prequelcoding .

let us see the coding to get a perfect picture.

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

int main()
{
   char str1[60] = "coder's space ";
   char str2[] = "prequelcoding";
   
   strcat(str1, str2);
   printf("%s\n", str1);
    return 0;
}

Scroll to top