Answer Posted / lylez00
#include <string.h>
/* strcmp */
int (strcmp)(const char *s1, const char *s2)
{
unsigned char uc1, uc2;
/* Move s1 and s2 to the first differing characters
in each string, or the ends of the strings if they
are identical. */
while (*s1 != '\0' && *s1 == *s2) {
s1++;
s2++;
}
/* Compare the characters as unsigned char and
return the difference. */
uc1 = (*(unsigned char *) s1);
uc2 = (*(unsigned char *) s2);
return ((uc1 < uc2) ? -1 : (uc1 > uc2));
}
| Is This Answer Correct ? | 7 Yes | 3 No |
Post New Answer View All Answers
What is ifstream c++?
Which coding certification is best?
What will happen if a pointer is deleted twice?
How does class accomplish data hiding in c++?
How can you specify a class in C++?
Which c++ operator cannot overload?
What are libraries in c++?
What is the use of class in c++?
What c++ library is string in?
What is split a string in c++?
Why do we need runtime polymorphism in c++?
what is c++
What is the use of this pointer in c++?
What information can an exception contain?
How can you link a c program with a c function?