Friday, 13 April 2012

C program to Concatnate two string or addition of two string

//Green lines shows they are commented
#include<stdio.h>  //header files
#include<string.h> //Header files
 
void main()  //starting of main
{
   char str1[100], str2[100];
 
   printf("Enter the first string\n");
   gets(str1);
 
   printf("Enter the second string\n");
   gets(str2);
 
   strcat(str1,str2);  //predefine function to perform concatnation
 
   printf("String obtained on concatenation is %s\n",str1);
 
} //End of main

No comments:

Post a Comment

Compiler for C,C++ and Python {paste your programme to see the output}