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
How do you declare a set in c++?
What is the most powerful coding language?
When do we run a shell in the unix system?
Why struct is used in c++?
What is abstract keyword in c++?
Will the following program execute?
What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass
What is object file? How can you access object file?
What do you mean by public protected and private in c++?
What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.
Why is the function main() special?
Are there any special rules about inlining?
Do inline functions improve performance?
Is c++ primer good for beginners?
What are virtual functions in c++?