Receive two strings from the user, concatenate both the strings and display
the length of the concatenated string in c language
Answers
Answered by
1
Answer:
In C Language using strcat() and strlen() function
#include <stdio.h>
#include<string.h>
void main() {
char string1[100];
char string2[100];
printf("Enter any string: ");
gets(string1);
printf("Enter any string: ");
gets(string2);
strcat(string1,string2); // Simply string1 = string1+string2
printf("The new string is: %s\n",string1);
int len = strlen(string1); // The concatenated string will be stored in string1 so len of string1
printf("The length of the concatenated string is: %d",len);
}
Attachments:
Similar questions
Math,
1 day ago
Environmental Sciences,
1 day ago
English,
2 days ago
Math,
2 days ago
English,
8 months ago