C | Operators | Question 4
#include <stdio.h> int main() { Â Â Â int i; Â Â Â Â Â i = 1, 2, 3; Â Â Â printf("%d", i); Â Â Â Â Â Â return 0; }
(A) 1
(B) 3
(C) Garbage value
(D) Compile time error
Answer: (A)
Explanation: Comma acts as an operator. The assignment operator has higher precedence than comma operator. So, the expression is considered as (i = 1), 2, 3 and 1 gets assigned to variable i.
Quiz of this Question
Please Login to comment...