Govt. Exams
Entrance Exams
The 'static' keyword gives a variable static storage duration, preserving its value between function calls.
When -10 is assigned to an unsigned int format (%u), it gets interpreted as a large positive number due to two's complement representation on a 32-bit system.
In C99+, auto is rarely used since local variables are automatic by default, but it remains valid syntax.
(int)(3.9) = 3, then 3 + 0.5 = 3.5, but %d prints as int 3 (truncated).
Local variables declared inside functions have automatic storage duration and are destroyed on function exit.
Volatile prevents compiler optimizations by signaling the variable may change outside program control (hardware/signals).
Global variables with extern keyword have global scope and external linkage across translation units.
Size of long double varies: typically 12 or 16 bytes on different systems and compilers.
Both 'int x;' and 'static int x;' allocate memory. Extern only declares without allocation.
int x = 10;
int *p = &x;
printf("%d", *p + 5);
*p dereferences pointer to get value 10, then 10+5=15 is printed.