Govt. Exams
Entrance Exams
Padding ensures that structure members are aligned in memory according to their natural boundaries, improving CPU access speed.
The arrow operator (->) is used to access structure members through a pointer. Dot (.) is for direct variables.
struct s { int a; char b; int c; }; printf("%lu", sizeof(struct s));
Due to memory alignment/padding: int a(4) + char b(1) + 3 padding bytes + int c(4) = 12 bytes.
typedef struct creates an alias, so you can declare variables directly using the alias name without repeating 'struct'.
Correct syntax is 'struct typename *pointerName;'. Option A follows proper declaration syntax.
Uninitialized local structure variables contain garbage values. Global structures are automatically initialized to zero.