Breaking News

C program to Concatenate two Strings without using Strcat function

Source Code-

#include<stdio.h>
int main()
{
char a[100],b[100];
    int length=0;
int i,j;
    printf("Enter the first string\n");
    gets(a);

    printf("Enter the second string\n");
    gets(b);
    for(i=0;a[i]!='\0';i++)
    {
        length=length+1;
    }
    for(i=length,j=0;a[j]!='\0';i++,j++)
    {
        a[i]=b[j];
    }
    printf("The new string is:");
    puts(a);
    return 0;
}
Output-

No comments

shankhajana. Powered by Blogger.