Write a program to compare two strings without using the
strcmp() function
Answer Posted / shaiju . a
int str_cmp( const char *str1 , const char *str2)
{
while(*str1 != '\0')
{
if( *str1 == *str2)
{
str1++;
str2++;
}
else
break;
}
return *str1 - *str2;
}
| Is This Answer Correct ? | 64 Yes | 78 No |
Post New Answer View All Answers
What are enumerated types?
What is a char c?
Which is better oop or procedural?
What is calloc malloc realloc in c?
Is it acceptable to declare/define a variable in a c header?
Is there anything like an ifdef for typedefs?
What is wild pointer in c?
The statement, int(*x[]) () what does in indicate?
Explain what are bus errors, memory faults, and core dumps?
What are header files in c programming?
What are the rules for the identifier?
what does static variable mean?
Explain the use of 'auto' keyword
Write a program to know whether the input number is an armstrong number.
How can I read data from data files with particular formats?