The following is a C Program To Concatenate Two Strings using strcat on screen after taking input from the user. Let's get started.

Concatenate Two Strings Using strcat
Concatenate Two Strings Using strcat

Overview:


Commands

gets() function is used to obtain input as a string and printf() function is used to print the string on the screen.
strcat(a,b) is a function used for concatenating multiple strings or joining them.

Program

#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
    char a[100],b[100];
    clrscr(); 
    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);
    getch();
}


Output

Concatenated Strings
Concatenated Strings

All programs compiled in this post are compiled in AnDOSBox.

Books I Prefer:






I hope this article was helpful to understand C Program To Concatenate Two Strings using strcat! Comment below, if you've got any question. Head back soon for another interesting article on C Programming.