strcat

Solutions on MaxInterview for strcat by the best coders in the world

showing results for - "strcat"
Enrico
18 Mar 2020
1strcat or strcpy is used to connect two string
2like in here in this example the output will be these strings are concatenated.
3  
4#include <stdio.h>
5#include <string.h>
6
7int main ()
8{
9  char str[80];
10  strcpy (str,"these ");
11  strcat (str,"strings ");
12  strcat (str,"are ");
13  strcat (str,"concatenated.");
14  puts (str);
15  return 0;
16}
Sean
18 Jun 2020
1#include <stdio.h>
2#include <string.h>
3
4int main() {
5   char str1[100] = "This is ", str2[] = "A Name";
6
7   // concatenates str1 and str2
8   // the resultant string is stored in str1.
9   strcat(str1, str2);
10
11   puts(str1);
12   puts(str2);
13
14   return 0;
15}
Christopher
28 Sep 2016
1#include <stdio.h>
2#include <string.h>
3
4int main () {
5   char src[50], dest[50];
6
7   strcpy(src,  "This is source");
8   strcpy(dest, "This is destination");
9
10   strcat(dest, src);
11
12   printf("Final destination string : |%s|", dest);
13   
14   return(0);
15}
Axel
27 Oct 2018
1#include <stdio.h>
2#include <string.h>
3int main() {
4   char str1[100] = "This is ", str2[] = "programiz.com";
5
6   // concatenates str1 and str2
7   // the resultant string is stored in str1.
8   strcat(str1, str2);
9
10   puts(str1);
11   puts(str2);
12
13   return 0;
14}