I know that strcmp returns…
A value greater than zero indicates that the first character that does
not match has a greater value in str1 than in str2; And a value less
than zero indicates the opposite.
But what do those positive or negative numbers mean? for example what does 2 mean?
In short, nothing. It usually depends on how the function is implemented, but you can’t rely on it.
For instance, in the implementation they talk about here (3rd post): http://compsci.ca/v3/viewtopic.php?t=24383 it returns the difference between (the numeric representations of) the first differing characters, i.e.
strcmp("ab","ad")would return-2.Alternately, for this implementation, http://en.wikibooks.org/wiki/C_Programming/Strings#The_strcmp_function the same call would return
-1.