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
Explain storage qualifiers in c++.
Why do we use setw in c++?
Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c
what is pre-processor in C++?
Which ide is best for c++?
Describe public access specifiers?
What is this weird colon-member (" : ") syntax in the constructor?
What are inline functions? What is the syntax for defining an inline function?
What can I use instead of namespace std?
Can comments be nested?
Which function should be used to free the memory allocated by calloc()?
What should main() return in c and c++?
How do you declare A pointer to a function which receives nothing and returns nothing
Which is the best c++ compiler for beginners?
Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be