[Solved] Format specifier behavior in C [closed]


In first example you are reading it as ’20’ and ‘3’ -> So not equal.

In second exmple you are reading it as ’20’ and ‘ 3’-> note space.

Its not 2 vs 3. It is 20 vs 3. %d will read whole string. You may want to check with %1d

Return from strcmp

Returns an integral value indicating the relationship between the
strings: A zero value indicates that both strings are equal. 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.

3

solved Format specifier behavior in C [closed]