Govt. Exams
Entrance Exams
5/2 is integer division (not float division), so result is 2 (integer), then converted to 2.0 (float).
int (*func)(); declares a pointer to a function that returns int. Option A declares a function returning pointer to int.
Initial: a=1, b=2. After step 1: a=3, b=2. After step 2: a=3, b=1. After step 3: a=2, b=1. Output is '2 1'.
A static variable declared in a block has block scope but static storage duration, persisting between function calls.
This involves undefined behavior due to modification of x multiple times without intervening sequence points.
Multiple post-increments without sequence points lead to undefined behavior.
This exhibits undefined behavior due to multiple modifications of the same variable 'x' without intervening sequence points.
The 'register' keyword is a hint for compiler optimization. Modern compilers often ignore it as they have sophisticated optimization strategies.
Type casting (int)3.7 truncates the decimal part, converting 3.7 to 3. The fractional part is discarded.
When 'static' is applied to a function at file scope, it restricts the function's visibility to that translation unit (file) only.