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
What is the use of #include in c?
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
What is include directive in c?
What is the difference between the expression “++a” and “a++”?
Can we use any name in place of argv and argc as command line arguments?
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
Explain what is the purpose of "extern" keyword in a function declaration?
to find the closest pair
Here is a neat trick for checking whether two strings are equal
What is the use of clrscr?
What is difference between class and structure?
What is indirection? How many levels of pointers can you have?
What are the two types of functions in c?
What is the purpose of the preprocessor directive error?
Can you please explain the difference between malloc() and calloc() function?