C | Operators | Question 24
#include <stdio.h> int main() { int x = 10; int y = (x++, x++, x++); printf("%d %d\n", x, y); return 0; } |
chevron_right
filter_none
(A) 13 12
(B) 13 13
(C) 10 10
(D) Compiler Dependent
Answer: (A)
Explanation: The comma operator defines a sequence point, so the option (d) is not correct.
All expressions are executed from left to right and the value of rightmost expression is returned by the comma operator.
Quiz of this Question
Recommended Posts:
- Operators in C | Set 2 (Relational and Logical Operators)
- C | Operators | Question 4
- C | Operators | Question 26
- C | Operators | Question 27
- C | Operators | Question 21
- C | Operators | Question 3
- C | Operators | Question 2
- C | Operators | Question 17
- C | Operators | Question 18
- C | Operators | Question 27
- C | Operators | Question 13
- C | Operators | Question 12
- C | Operators | Question 11
- C | Operators | Question 10
- C | Operators | Question 16



