My Subject Blog

C Program to Concatenate Two Strings

/*
Write a program to append one string to another String. 
*/

    #include <stdio.h>
     
    int main(void) {
    // your code goes here
    char str1[100],str2[50];
    int i,j;
    printf("Enter the First String : ");
    scanf("%s",str1);
    printf("Enter the Second String : ");
    scanf("%s",str2);
    for(i=0;str1[i]!='\0';i++)
    {
     
    }
    for(j=0;str2[j]!='\0';j++)
    {
    str1[i]=str2[j];
    i++;
    }
    str1[i]='\0';
    printf(" Concatenated String : %s",str1);
    return 0;
    }

Comments

Most Visited Post

C Program to Find Largest Odd Number from Array

C Program for Runtime Memory Allocation for Table of Integers

Followers