LearnFrenzy
Sign in Take a free test

Operators and Expressions · Operators MCQ · Question 4

Associativity of the assignment operator in C Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 4 Back to Exercise

How is a = b = c = 0; grouped?

  • A ((a = b) = c) = 0
  • B a = (b = (c = 0)) Correct
  • C It is a syntax error
  • D Only a is set
Correct Answer: Option B

Assignment is right-associative, and its value is the value assigned. So c is set to 0, that value is assigned to b, then to a.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links