编写带有多个||的if语句的简洁方法是什么 和&&在C?
我想只执行一个printf语句,如果1,2,4或6 AND b = 8和c = 10,我可以将所有这些条件放在同一个if语句中吗?
例如.我可以这样写:
if ((a = 1||2||4||6) && b == 8 && c == 10) //do something
这似乎不起作用......
c if-statement multiple-conditions
c ×1
if-statement ×1
multiple-conditions ×1