What is wrong with this assignment in a conditional operator?

前端 未结 4 1007
独厮守ぢ
独厮守ぢ 2021-01-15 09:18

There is an error. Is it wrong to assign a value to a[i] in the following code? Or something is wrong with conditional operators?

#include
#in         


        
4条回答
  •  离开以前
    2021-01-15 09:50

    Use = once in your statement, since it has lower precedence over ?:. Something like:

    a[i] = a[i] > 90 ? a[i] - 32 : a[i] + 32;

提交回复
热议问题