#include <iostream.h>
#include <conio.h>
#include<stdio.h>
void concatenate (char str1[40],char str2[40]) ;
void main ()
{
char str1[60] , str2[40] ;
puts ("Enter the first string :") ;
gets (str1) ;
puts ("\nEnter the second string :") ;
gets (str2) ;
concatenate (str1,str2) ;
puts ("\nThe concatenated string is :") ;
puts (str1) ;
getch ( ) ;
}
void concatenate (char str1[40], char str2[40])
{
int i, j;
i = 0 ;
while (str1[i] != '\0')
i++ ;
str1[i] = ' ' ;
i++ ;
j = 0 ;
while (str2[j] != '\0')
{
str1[i] = str2[j] ;
i++ ;
j++ ;
}
}
0 comments:
Post a Comment