+2

Can "if" statements in c have multiple conditions

For example if (a==0, b==0, c ==1) { ...

9/6/2019 2:00:51 PM

Omooba Emmanuel

4 Answers

New Answer

+6

Yes they can, however, you should not chain them with a comma, it would lead to only the right-most expression being decisive for the result of the entire condition. Instead, use logical operators: https://www.sololearn.com/learn/C/2925/

+3

Use logical operator '&&' instead of commas.

+3

Some challenge questions may trick you with the comma separators you used but the logical ones are most common here.

+2