Follow Us

LightBlog

Breaking

Tuesday, February 28, 2017

String concatenation in c without using strcat ?


String concatenation in c without using strcat ?


#include<stdio.h>
#include<conio.h>
void main(void)
{
  char s1[25],s2[25];
  int i=0,k=0;
  printf("\nEnter First String:");
  gets(s1);
  printf("\nEnter Second String:");
  gets(s2);
  while(s1[i]!='\0')
  i++;
  while(s2[k]!='\0')
  {
    s1[i]=s2[k];
    j++;
    k++;
  }
  s1[i]='\0';
  printf("\nConcatenated String is %s",s1);
}

No comments:

Post a Comment