Multiple choice technology programming languages

Determin Output: int main() { int a, b,c, d; a=3; b=5; c=a,b; d=(a,b); printf("c = %d" ,c); printf("\n\nd = d" ,d); return 0; }

  1. 5,5

  2. 3,3

  3. 3,5

  4. Error

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In C, the comma operator evaluates its left operand, discards the result, and returns the right operand. Thus, c = a, b; binds as (c = a), b; due to operator precedence, setting c to 3. Meanwhile, d = (a, b); evaluates the group, setting d to 5. The printed output is c = 3 and d = 5, which is matches option '3,5'.