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

How to run shell script   |   Php array functions with examples pdf   |   How to run java program in cmd

QUOTES OF THE DAY

Everything flows, nothing stays still.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER