Skip to content
Official PYQ · 2000

GATE CS 2000 Q1.11 — Programming in C

Explain with AI

The following C declarations:

struct node { 
    int i:
    float j;
 };
 struct node *s[10];

define s to be:

Choose one option
View worked solution

Answer: A

To understand the declaration struct node *s[10];, we analyze the precedence of operators in C:

  • The array subscript operator [] has higher precedence than the pointer dereference operator *.
  • As a result, the identifier s associates first with [10], making s an array of 10 elements.
  • The prefix struct node * specifies the type of these elements, which is a pointer to struct node.

Therefore, s is an array, each element of which is a pointer to a structure of type node.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Programming in C questions