Concat two string with most overlapped substring has to
remove  "abcd"+ "cdef" = "abcdef

Answer Posted / sham

char *strappend1(char *src,char *des)
{
char *tmp=src;
int f=0;
while(*des)
{
while(*src!='\0')
{
if(*src==*des)
{
f=0;
break;
}
else
f=1;
src++;
}
if(f==1)
{
*src++=*des;
*src='\0';
}
des++;
}
return tmp;
}
int main(int argc,char **argv)
{
char *src=argv[1],*des=argv[2];
char *str;
str=strappend1(src,des);
printf("%s",str);
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of #include in c?

585


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

764


What is include directive in c?

650


What is the difference between the expression “++a” and “a++”?

652


Can we use any name in place of argv and argc as command line arguments?

613






void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1263


Explain what is the purpose of "extern" keyword in a function declaration?

625


to find the closest pair

1827


Here is a neat trick for checking whether two strings are equal

568


What is the use of clrscr?

602


What is difference between class and structure?

576


What is indirection? How many levels of pointers can you have?

665


What are the two types of functions in c?

575


What is the purpose of the preprocessor directive error?

687


Can you please explain the difference between malloc() and calloc() function?

623