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
Define whitespace in C++.
What is the difference between structure and class?
What does int * mean in c++?
Is map sorted c++?
What is format for defining a structure?
Explain the different access specifiers for the class member in c++.
Tell me what are static member functions?
What is the standard template library (stl)?
What is abstraction with real time example?
How do you define/declare constants in c++?
What does the linker do?
What is split a string in c++?
What is abstract class in c++?
Mention the purpose of istream class?
Can constructor be static in c++?