Pages

Write a program in c language to concatenate two strings.

Monday, 15 July 2013

#include<conio.h>
#include<stdio.h>

void stringconcatenation(char[],char[]);

 main()
{

    char mrr1[100],mrr2[100];
    printf("Enter the first string: ");
   gets(mrr1);
    printf("Enter the second string: ");
    gets(mrr2);
    stringconcatenation(mrr1,mrr2);
   printf("The String after concatenation: %s",mrr1);
    getch();
}
void stringconcatenation(char mrr1[],char mrr2[])
{
    int l=0,k=0;
    while(mrr1[l]!='\0')
    {
         l++;
    }
  while(mrr2[k]!='\0')
    {
         mrr1[l] = mrr2[k];
         l++;
         k++;
    }
 mrr1[l] ='\0';
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *