jeudi 16 septembre 2021

How to combine operators in an IF

I'm having doubts in coding a loop repeat where conv0 == 255 and conv1 == 216 and conv3 can have 16 different types of combinations. I'm having difficulties in this section of the code.

if( conv0 == 255 && conv1 == 216 && 
    (
      conv2 == 224 || conv2 == 225 ||
      conv2 == 226 || conv2 == 227 ||
      conv2 == 228 || conv2 == 229 ||
      conv2 == 230 || conv2 == 231 ||
      conv2 == 232 || conv2 == 233 ||
      conv2 == 234 || conv2 == 235 ||
      conv2 == 236 || conv2 == 237 ||
      conv2 == 238 || conv2 == 239 
    )
  )
{
    printf("OK \n ");
}

Thank you.

Aucun commentaire:

Enregistrer un commentaire