Program to concatenate
the given two strings
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
char str1[20], str2[20], strcon[40];
int i, j;
clrscr();
printf("Enter the first string : ");
scanf("%s", str1);
printf("\nEnter the second string : ");
scanf("%s", str2);
for(i = 0; str1[i] != '\0'; i++)
strcon[i] = str1[i];
i--;
for(j = 0; str2[j] != '\0'; j++)
strcon[i + j + 1] = str2[j];
strcon[i + j + 1] = '\0';
printf("\nThe concatenation string is : %s", strcon);
getch();
}
Output:
Enter the first string : Anna
Enter the second string : University
The concatenation string is : AnnaUniversity
-
UpdatedDec 31, 2019
-
Views4,583
You May Like
Program to maintain employee details using structures
Program to maintain student details using structures
Check whether the person is eligible to vote or not
Print the numbers that are divisible by a given no.
Program to generate magic square
To sort the given numbers in ascending & descending order