Friday, December 3, 2010

The Comma Operator

The value of x after the following statements (1 or 2): int x; x = 1, 2; is 1.

Assignment has higher precedence than the comma operator.

Note that the following does not compile: int x = 1, 2; because, in this case, another variable is expected with an "=" sign before the "2".

No comments:

Post a Comment