Govt. Exams
Entrance Exams
volatile tells the compiler that the variable's value may change unexpectedly (e.g., by hardware, signals, or another thread), so the compiler should not optimize it.
restrict prevents pointer aliasing (not allows). It tells compiler that pointer is the only way to access that object.
Due to structure padding/alignment, the size becomes 24 bytes (8-byte alignment for double). Members are padded to maintain alignment.
extern is a declaration (not definition) that tells compiler the variable exists elsewhere in program. It provides global scope.
int a = 5;
int *p = &a;
int **q = &p;
printf("%d", **q);
q is a pointer to pointer p. **q dereferences both pointers, giving the value of a, which is 5.
Option A shows pointer arithmetic where p++ increments the pointer by the size of int (4 bytes). Other options are regular arithmetic operations.
struct test {
char c;
int i;
float f;
};
Size depends on compiler's padding and alignment rules. Typically 12 bytes with padding, but varies by system.