Concat strings in C language

www.l‮uttua‬ri.com
Concat strings in C language
#include <stdio.h>
#include <string.h>
int main(void)
{
  //variable
  char
    str1[] = "Hello",
    str2[] = "World",
    str3[100] = "";
    
  //concat
  strcat(str3, str1);  //concat "Hello" to str3 so, str3 = "Hello"
  strcat(str3, " ");   //concat " " to str3     so, str3 = "Hello "
  strcat(str3, str2);  //concat "World" to str3 so, str3 = "Hello World"
  
  printf("Concatenated string: %s\n", str3);
  printf("End of code\n");
  return 0;
}

output:

Concatenated string: Hello World
End of code
Created Time:2017-08-28 07:08:46  Author:lautturi