Search This Blog

Wednesday 13 January 2016

Concate two Strings

#include<stdio.h>
#include<conio.h>
void main()
{
    int len=1,i,j;
    char a[100],b[100];
    clrscr();
    printf("enter string a:");
    gets(a);
    printf("Enter string b:");
    gets(b);
    for(len=0;a[len]!=NULL;len++);
    for(i=0,j=len;b[i]!=NULL;i++,j++)
    {
        a[j]=b[i];
    }
    a[j]=NULL;
    printf("string a is ");
    puts(a);
    getch();

}

No comments:

Post a Comment