| | | | | |

Operator Associativity

  • Each operator has a default associativity
  • Associativity of operator + is LR
  • sum = x + y + z;    
    sum = (x + y) + z;  // statement meaning identical to first
    
  • Associativity of operator = is RL
  • a = b = c;    // valid statement
    a = (b = c);  // identical meaning
    
  • Except for assignment operator=, binary operators associate LR

| | Top of Page | 1. Basic C++: A Review - 12 of 21