Tag Archives: adding string

Write a program to read two strings and append second to first


#include<stdio.h>
#include<string.h>
int main()
{

char str1[40];
char str2[40];
printf(“Enter the first string:n”);
gets(str1);
printf(“Enter the second string:n”);
gets(str2);
strcat(str1,str2);
printf(“String 1 is now:n”);
puts(str1);
return 0;
}

Advertisements