Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  concatenate a string
Language: C/C++
Code:
#include<stdio.h>
main()
{
char a[20],b[20];
int c=0,d=0,f=0,i,j;
printf(" enter the string a :");
scanf("%s",a);
printf(" enter the string b :");
scanf("%s",b);
for(i=0;a[i]!='\0';i++)
{
c++;
}
for(j=0;b[j]!='\0';j++)
{
d++;
}
f=c+d;
i=c;
for(j=0;a[j]!='\0';j++)
{
for(;f>0;)
{ if(a[i]=b[j])
{
i++;
f--;
break;}}}
printf("%s\n%s",a,b);
}
Comments: