Multiple choice

Which of the following C operators is right associative?

  1. =

  2. ,

  3. []

  4. ^

  5. ->

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The assignment operator (=) is right-associative, meaning it groups from right to left. For example, a = b = c is evaluated as a = (b = c), where c is assigned to b first, then the result is assigned to a. The comma operator (,), subscript ([]), bitwise XOR (^), and arrow operator (->) are all left-associative.