I've run this code, with the answers in the comments on the right. Is anyone able to explain how these numbers are calculated. I understand I'm comparing string S to the string "BCDEF", and understand the result will be 0 if they're equal, but I'm stumped on the below!
The value is not important. It may not be the same value on all compilers and plaforms.
google the compare function. All you are assured is:
1 2 3 4
value relation between compared string and comparing string
0 They compare equal
<0 Either the value of the first character that does not match is lower in the compared string, or all compared characters match but the compared string is shorter.
>0 Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer.