Skip to content
Related Articles

Related Articles

Improve Article

C | Operators | Question 3

  • Difficulty Level : Easy
  • Last Updated : 05 Jan, 2013
#include <stdio.h>

int main()
{
    int i = (1, 2, 3);
    
    printf("%d", i);
    
    return 0;
}

(A) 1
(B) 3
(C) Garbage value
(D) Compile time error


Answer: (B)

Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.




 

Explanation: The bracket operator has higher precedence than assignment operator. The expression within bracket operator is evaluated from left to right
but it is always the result of the last expression which gets assigned.

My Personal Notes arrow_drop_up
Recommended Articles
Page :