Home C-tutorials C String Concatenation



C String Concatenation
Posted on: February 6, 2009 at 12:00 AM
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.

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

Related Tags for C String Concatenation:
cstringcomstringsioorderthisexamplecombinestudyconcatenatenattoexambieilsectioncaninconcatmtrcacldeclarehowcatbinxaxampseeatishallivmplarstrtwssriringrdthavsteclpleplonombomo


More Tutorials from this section

Ask Questions?    Discuss: C String Concatenation   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.