Solved programming problem

Concatenate two string with string.h in C.

Source code

#include <stdio.h>

#include<string.h>

int main()

{

    char str1[100],str2[100];

    int len,i=0;

    printf("Please Enter 1st Massage: ");

    gets(str1);

    printf("Please Enter 2nd Massage: ");

    gets(str2);

     strcat(str1,str2); /// string Concatenate function

    printf("
Your Massage is: %s
",str1);

    return 0;

}

Output

Please Enter 1st Massage: code to

Please Enter 2nd Massage: haven

Your Massage is: code to haven

Join the discussion

Add your comment