pTutorial

New way to learn C programming

C Program to concatenation of two sting

These programs concatenate one to other string to the another string using strcat function from the string.h library and without strcat function. Let's take an example, suppose "wel" is a string and "come" is another string after concatenating the result will be "welcome".

String concate c program



#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
  char z[90], x[90];
  
   printf("Enter 1st string\n");
   gets(z);

   printf("Enter 2nd string\n");
   gets(x);
    
   strcat(x, z);
   printf("String: %s\n", x);
  
   getch();  
}

Download String concate c program

Output of program

string concatenation | ptutorial

In this example, enter two strings using gets function and after that pass both string variables to the strcat function, strcat function return concatenated string in the first argument (x).

See Also

Need of ajax   |   Php interview pdf/php interview question   |   C program to add array

QUOTES OF THE DAY

To make your children capable of honesty is beginning of education.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER