i need some help with a piece of code.
I have an array, lets call it array[4].
Now I want to check that at least 3 elements of this array are taller than a threshold. (if statement)
E.g.
if(2 > ((array[0] > threshold) + (array[1] > threshold) + (array[2] > threshold) + (array[3] > threshold) ))
Here Misra is complaining. (Rule 10.1 Unpermitted operand operator "+")
Is there another way to code this if statement without checking every possible permutation ?
Cheers
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…