@yLaguardia answered the order problem well.
int strcmp(const char *s1, const char *s2);
The strcmp function returns an integer greater than, equal to, or less than zero, respectively, since the string pointed to by s1 is greater than, equal to, or less than the string pointed to by s2 , C11dr Β§7.24.4.2 3
Using uint8_t great for the vast majority of cases. Rare machines do not use 8-bit char , so uint8_t not available. In any case, this is not necessary, since unsigned char handles the required unsigned char comparison. (See below for unsigned comparisons.)
int result1 = ((unsigned char)*str1 - (unsigned char)*str2);
Even higher portable code will use the following to handle the range of char and unsigned , as well as all other sizes and ranges of char, unsigned char, int, unsigned .
int result1 = ((unsigned char)*str1 > (unsigned char)*str2) - ((unsigned char)*str1 < (unsigned char)*str2);
strcmp() defined as processing each character as an unsigned char , regardless of whether the char signed or unsigned.
... each character should be interpreted as if it were of type unsigned char ... C11 Β§7.24.1 3
If char is ASCII or not, this does not apply to strcmp() encoding. Of course, with different character encodings, different results may occur. Example: strcmp("A", "a") can lead to a positive answer (rarely used by EBCDIC ) with one encoding, but a negative ( ASCII ) to another.