Will a C conditional always return 1 or 0?

后端 未结 4 1372
不思量自难忘°
不思量自难忘° 2021-01-11 23:50

Do C conditional statements always return [1 or 0], or do they return [0 or \'something other than zero\']. I ask because:

pseudo code -

f

4条回答
  •  独厮守ぢ
    2021-01-12 00:37

    Standard specifies that the result is always integer value equals to 0 or 1

    6.5.8 Relational operators

    Each of the operators < (less than), > (greater than), <= (less than or equal to), and >= (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.92) The result has type int.

提交回复
热议问题