#include<conio.h>
#include<stdio.h>
void stringconcatenation(char[],char[]);
void main()
{
char str1[100],str2[100];
int compare;
printf("Enter the first string: ");
gets(str1);
printf("Enter the second string: ");
gets(str2);
stringconcatenation(str1,str2);
printf(" The String after concatenation: %s",str1);
getch();
}
void stringconcatenation(char str1[],char str2[])
{
int i=0,j=0;
while(str1[i]!='\0')
{
i++;
}
while(str2[j]!='\0')
{
str1[i] = str2[j];
i++;
j++;
}
str1[i] ='\0';
}
#include<stdio.h>
void stringconcatenation(char[],char[]);
void main()
{
char str1[100],str2[100];
int compare;
printf("Enter the first string: ");
gets(str1);
printf("Enter the second string: ");
gets(str2);
stringconcatenation(str1,str2);
printf(" The String after concatenation: %s",str1);
getch();
}
void stringconcatenation(char str1[],char str2[])
{
int i=0,j=0;
while(str1[i]!='\0')
{
i++;
}
while(str2[j]!='\0')
{
str1[i] = str2[j];
i++;
j++;
}
str1[i] ='\0';
}
No comments:
Post a Comment