本文介绍了&是什么QUOT;比较布尔前pression不变的是永远真QUOT;警告是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是什么意思的警告( I Ĵ不是常量):

我一直在试图谷歌这一点,但它并没有给我任何结果。

In my program, i and j are not constant values and they do change.

解决方案

In C, chaining of relational operators like this are not valid design. Thus,

 (0<=i<=10)

is not doing what you think it should be doing. it is getting evaluated as

((0<=i) <= 10 )

which is basically either

  • 0 < = 10, producing 1 (considered TRUE value)
  • 1 < = 10, also producing 1 (considered TRUE value)

sadly, both of which are way out than the expected path.

Solution: you need to break down your condtion check like

 (0 <= i) && ( i<=10)

这篇关于&是什么QUOT;比较布尔前pression不变的是永远真QUOT;警告是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 02:43