Computer Science, asked by darbari221008, 2 days ago

Receive two strings from the user, concatenate both the strings and display
the length of the concatenated string in c language

Answers

Answered by velox
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