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)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…