Will a C conditional always return 1 or 0?

后端 未结 4 1357
不思量自难忘°
不思量自难忘° 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:22

    Doesn't matter if it is specified or not. It is best to always test against false and be explicit about your or-equals values. This removes any worry about compiler implementations and is clearer and more maintainable.

提交回复
热议问题