Thursday, 25 August 2016

C Program to concat two strings using strcat()


A simple C program which concats two strings. the second string appends to first string and forms a concatenated string.

Here string concatination is done using strcat() function.

Look below for program and the screenshot,


Download code

PROGRAM : 

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

int main()
{
    char string1[50], string2[50];
    printf("\nEnter First string :");
    gets(string1);
    printf("\nEnter Second string :");
    gets(string2);
    strcat(string1,string2);
    printf("\nConcatenated string is :%s\n", string1);
    return (0);
}
Download code

OUTPUT : 

C Program - String concatenation using strcat()