This program is a C program that concatenates two strings entered by the user. The program takes two strings as input from the user and then copies the first string into another character array called 'c' and then copies the second string into the same 'c' character array, making it a concatenated string of the two input strings. The concatenated string is then displayed to the user. The 'gets' function is used to take input from the user, while 'puts' is used to display the output. The program uses a loop to copy the contents of the first and second string into the third string, 'c'. The loop continues until the end of the first or second string is reached, whichever comes first.
#include<stdio.h> int main() { int i,j,n,k=0; char a[100],b[100],c[100]; printf("\nEnter the First String:"); gets(a); printf("\nEnter the Second String:"); gets(b); printf("\nGiven First String:"); puts(a); printf("\nGiven Second String:"); puts(b); for(i=0;a[i]!='\0';i++) { c[k]=a[i]; k++; } for(i=0;b[i]!='\0';i++) { c[k]=b[i]; k++; } printf("\nConcatenate Value is:%s",c); return 0; }To download raw file Click Here
Enter the First String:Tutor Enter the Second String:Joe's Given First String:Tutor Given Second String:Joe's Concatenate Value is:TutorJoe's
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions