Multiple choice technology programming languages

Determine Output : struct node { int a; int b; int c; }; int main() { struct node s= { 3, 5,6 }; struct node pt = &s; printf("Ans : %d" , *(int)pt); return 0; }

  1. 4

  2. 5

  3. 3

  4. Compile error

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

The struct s is initialized with a=3, b=5, c=6. The pointer pt points to s. Casting pt to (int*) and dereferencing reads the first integer member, which is a with value 3.