Govt Exams
A signed char occupies 1 byte (8 bits). With sign bit, it ranges from -128 to 127 (2^7 to 2^7-1).
long double provides maximum precision (typically 80-128 bits) for decimal numbers compared to float (32 bits) and double (64 bits).
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.
'volatile' tells the compiler that a variable's value may change unexpectedly (e.g., by hardware), preventing optimization.
Option A shows pointer arithmetic where p++ increments the pointer by the size of int (4 bytes). Other options are regular arithmetic operations.
Auto variables (local variables) contain unpredictable garbage values if not initialized. Static/global variables are initialized to 0.
Standard C guarantees short int is at least 16 bits (2 bytes). Most systems use exactly 16 bits.
float x = 5 / 2;
printf("%f", x);
5/2 performs integer division (both operands are int), resulting in 2. This is then converted to float as 2.0.
Static variables are automatically initialized to 0 by the compiler.
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.