Answers for "strcat"

2

strcat

strcat or strcpy is used to connect two string
like in here in this example the output will be these strings are concatenated.
  
#include <stdio.h>
#include <string.h>

int main ()
{
  char str[80];
  strcpy (str,"these ");
  strcat (str,"strings ");
  strcat (str,"are ");
  strcat (str,"concatenated.");
  puts (str);
  return 0;
}
Posted by: Guest on September-20-2021
4

string strcat function in c

#include <stdio.h>
#include <string.h>

int main() {
   char str1[100] = "This is ", str2[] = "A Name";

   // concatenates str1 and str2
   // the resultant string is stored in str1.
   strcat(str1, str2);

   puts(str1);
   puts(str2);

   return 0;
}
Posted by: Guest on July-09-2020
1

strcat

#include <stdio.h>
#include <string.h>

int main () {
   char src[50], dest[50];

   strcpy(src,  "This is source");
   strcpy(dest, "This is destination");

   strcat(dest, src);

   printf("Final destination string : |%s|", dest);
   
   return(0);
}
Posted by: Guest on February-03-2021
0

strcat

#include <stdio.h>
#include <string.h>
int main() {
   char str1[100] = "This is ", str2[] = "programiz.com";

   // concatenates str1 and str2
   // the resultant string is stored in str1.
   strcat(str1, str2);

   puts(str1);
   puts(str2);

   return 0;
}
Posted by: Guest on March-09-2021

Code answers related to "strcat"

Browse Popular Code Answers by Language