質問: 3)はCやC ++で真と評価できるのでしょうか。 Java で可能です。 a>および JavaScript But the question is, can the condition below *ever* evaluate to true **in C or C++?** ``` if(a==1 && a==2 && a==3) printf("SUCCESS"); ``` **編集** `a` が*整数*の場合
回答: If `a` is of a primitive type (i.e all `==` and `&&` operators are built in) and you are in defined behavior, and there's no way for another thread to modify `a` in the middle of execution (this is technically a case of undefined behavior - see comments - but I left it here anyway because it's the example given in the Java question), then I don't believe there is anything way for this to evaluate to true. However, as you can see by that list of conditions, there are many scenarios in which that expression could evaluate to true, depending on the types used and the context of the code.