C program to concatenate two strings [strcat()] || string manipulation in C || C programming
In this, we are going to see a program in which two strings or words are concatenated (combined) to make one string in C Programming Language.

//Concatenation of two Strings

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

int main()
{
    char str1[100], str2[100];

    printf("Enter first string\n");
    gets(str1);
    printf("Enter second string\n");
    gets(str2);

    //concatenates str1 and str2
    // the resultant string is stored in str1
    strcat(str1, " "); //adding a space between two strings
    strcat(str1, str2);

    printf("String obtained on concatenation: %s\n", str1);
    return 0;
}

//..........coded by ANANYA MAURYA


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post