Govt. Exams
Entrance Exams
int (*func_ptr)(int, int, int);
Which of the following function signatures can be correctly assigned to func_ptr?
func_ptr must point to a function that takes exactly 3 int parameters and returns int. Only option A matches this signature exactly.
memcpy(dest, src, count) copies 'count' bytes from src to dest. strlen() and sizeof() may not give correct results for all data types.
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.