Given the expression a = b = c, which assignment is evaluated first?
- Evaluation Order is Not Defined
- a = b
- b = c
- c = a
In C and C++, assignment operators associate right-to-left. So, b = c is evaluated first, assigning the value of c to b, and then a = b assigns the value of b to a. This behavior is consistent with other binary operators in these languages.
Loading...
Related Quiz
- What happens to the control flow of a program when the break statement is encountered inside a while loop?
- Consider a large-scale software project that heavily utilizes templates and generic programming. With an impending deadline, the compilation time is becoming a significant bottleneck. Which C++ feature/technique might be best suited to reduce compilation times without altering runtime performance?
- What is the difference between break and continue in the context of a loop?
- In nested loops, how does the break keyword behave when used inside the inner loop?
- Which of the following data types can store a non-integer number?