Why does strcmp() return 0 when its inputs are equal?

strcmp returns a lexical difference (or should i call it “short-circuit serial byte comparator” ? 🙂 ) of the two strings you have given as parameters.
0 means that both strings are equal

A positive value means that s1 would be after s2 in a dictionary.

A negative value means that s1 would be before s2 in a dictionary.

Hence your non-zero value when comparing “time” and “money” which are obviously different, even though one would say that time is money ! 🙂

Leave a Comment