# include <stdio.h>
# include <conio.h>
void main()
{
char *str1, *str2 ;
int i, j ;
clrscr() ;
printf("Enter the first string : ") ;
scanf("%s", str1) ;
printf("\nEnter the second string : ") ;
scanf("%s", str2) ;
for(i = 0; *str1 != '\0' ; i++, str1++) ;
for(j = 0; *str2 != '\0' ; j++, str1++, str2++)
*str1 = *str2 ;
*str1 = '\0' ;
str1 = str1 - i - j ;
printf("\nThe concatenated string is : %s", str1) ;
getch() ;
}
RUN 1 :
~~~~~~~
Enter the first string : hello
Enter the second string : world
The concatenated string is : helloworld
No comments:
Post a Comment