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 is the difference between c and python?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
What is volatile variable in c with example?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }
Explain how can you tell whether two strings are the same?
What is p in text message?
What is call by value in c?
Explain heap and queue.
What does the c preprocessor do?
What is a keyword?
What are enumerated types?
When the macros gets expanded?
When do we get logical errors?
Explain the difference between exit() and _exit() function?