Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Concatenation of two strings | STRCAT | C program

#include <stdio.h>
int main()
{
   char str1[50], str2[50], i, j;
   printf("\nEnter first string: ");
   scanf("%s",str1);
   printf("\nEnter second string: ");
   scanf("%s",str2);

   for(i=0; str1[i]!='\0'; ++i); 
   for(j=0; str2[j]!='\0'; ++j, ++i)
   {
      str1[i]=str2[j];
   }

   str1[i]='\0';
   printf("\nOutput: %s",str1);
   
   return 0;
}
Bhuvan Arora

No comments:

Amazing Deal !