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
Is c++ a good first language to learn?
What is a buffer c++?
What is the v-ptr?
Do you know what are static and dynamic type checking?
What is virtual function? Explain with an example
What are c++ templates used for?
What is this weird colon-member (" : ") syntax in the constructor?
What is ifstream c++?
What are features of c++?
What is #include cstdlib in c++?
What is data types c++?
Explain the uses of static class data?
How the endl and setw manipulator works?
an integer constant must have atleast one a) character b) digit c) decimal point
Does c++ have finally?