17 int compare_string(char *CompValue, char *ValuePtr)
20 unsigned char *p0 = (unsigned char *)CompValue;
21 unsigned char *p1 = (unsigned char *)ValuePtr;
23 for (i = 0; i == 0 && *p0 != '\0' && *p1 != '\0'; p0++, p1++)
44 #define test(a,b,shouldbe) { int res = compare_string(a, b); printf("Compare %s, %s -> %d (should be %d)\n", a, b, res, shouldbe); assert(res == shouldbe); }
47 test("Rothe", "Rother", -1);
48 test("hallo", "hallo", 0);
49 test("hallo", "welt", -1);
50 test("welt", "hallo", 1);
52 printf("Simpler: %d\n", simpler());