C program to concatenate two strings

c programming tutorial to concatenate two string program

concate.c
#include <stdio.h>
#include <string.h>
 
int main()
{
   char a[1000], b[1000];
 
   printf("Enter the first string\n");
   gets(a);
 
   printf("Enter the second string\n");
   gets(b);
 
   strcat(a,b);
 
   printf("String obtained on concatenation is %s\n",a);
 
   return 0;
}


Output


Enter the first string
Code
Enter the second string
World55
String obtained on concatenation is CodeWorld55

0 comments:

Post a Comment

My Instagram