CSE 202 Lab 3 Modify your main() to test correctness of both functions Give the
ID: 3716066 • Letter: C
Question
CSE 202 Lab 3 Modify your main() to test correctness of both functions Give the pointer version of both functions Test correctness of the new versions. Simply recompile and run! 5. Give the pointer version of the function strcmp(). This function returns 0, if the two char-arrays are equal (the same); a negative number, if target is source. Here are a few examples strcmp("abc", "abc") returns Q strcmp("abc", "abe") returns -2 stremp("abcdefg", "abe") returns -2 strcmp("ab", "???") returns l stremp("abcd", "abc") returns 100 stremp("abc", "abcd") returns -100 If the two strings are not cqual, this function returns the difference between the ASCII code of the characters where the first discrepancy occurs :27 AM Type here to search 4/25/2018Explanation / Answer
int strcmp(const char* s1, const char* s2) { while(*s1 && (*s1 == *s2)) { s1++; s2++; } return *(const unsigned char*)s1 - *(const unsigned char*)s2; }