[an error occurred while processing this directive]

C String Concatenation

                         

In this section you will study how to concatenate the two strings in C. You can see in the given example, we have declared two strings in order to combine the strings. For this, we have used the library function strcat() provided by the header file <string.h>. This method takes two char arguments and returns the concatenated string as a char.    

Here is the code:

STRINGCO.C

#include <stdio.h>
#include <conio.h>
#include <string.h>
int main() {
  char st1[] "RoseIndia";
  char st2[] "Technologies";
  strcat(st1, st2);
  printf("The Concatenated string is: %s\n", st1);
  getch();
  return 0;
}

Output will be displayed as:

STRINGCO.EXE

Download Source Code

                         

[an error occurred while processing this directive]