Concatenation of two strings without library function || String || C programming
In this, we are going to see a program for Concatenation of two strings without using strcat() with help of C Programming Language.


#include <stdio.h>

void main(void)
{
    char str1[25]="hello", str2[25]="world";
    int i = 0, j = 0;

    printf("Enter First String: ");
    // gets(str1);

    printf("Enter Second String: ");
    // gets(str2);

    while (str1[i] != '\0')
    {
        i++;
    }

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

    str1[i] = '\0';

    printf("Concatenated String is %s", str1);
}

//........coded by ANANYA MAURYA

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post