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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *