/*Serial No.117 [swami94.cpp]*/
#include<stdio.h>
#include<string.h>
#include<conio.h>
int leng(char str[20]);
void concat(char str4[20], char str5[20]);
void main()
{
char str1[20],str2[20],str3[20];
int i,j,len;
clrscr();
printf("Enter the first string:\n");
gets(str1);
printf("Enter the second string:\n");
gets(str2);
concat(str1,str2);
len=leng(str1);
printf("\n\n\nlength of first string using return=%d",len);
getch();
}
int leng(char str[20])
{
int i=0;
while(str[i]!='\0')
{
i++;
}
printf("\n\n\nlength of first string=%d",i);
return(i);
}
void concat(char str4[20], char str5[20])
{
int i=0,j;
char str6[20];
while(str4[i]!='\0')
{
str6[i]=str4[i];
i++;
}
j=0;
while(str5[j]!='\0')
{
str6[i]=str5[j];
i++;j++;
}
str6[i]='\0';
printf("\n\nConcanate string= %s",str6);
}
No comments:
Post a Comment
If you have any doubt, feel free to ask...