Source Code
// 55.i. Program to concatenate two strings using library function
// Arpan Das - CST 2nd Year (VOCLET)
#include <stdio.h>
//#include <conio.h>
#include <string.h>
void main () {
char str1[50], str2[50];
//clrscr();
printf("\t\t..:: concatenate two strings using library function ::..\n\n");
printf("\nEnter string 1: ");
//gets(str1);
scanf("%[^\n]%*c", str1); // String include spaces
printf("\nEnter string 2: ");
//gets(str2);
scanf("%[^\n]%*c", str2); // String include spaces
strcat(str1, str2);
puts(str1);
//getch();
}
Output
..:: concatenate two strings using library function ::..
Enter string 1: Hello
Enter string 2: World
HelloWorld