Govt. Exams
Entrance Exams
#include
int main() {
int x = 5;
int y = ++x * ++x;
printf("%d", y);
return 0;
}
The expression ++x * ++x modifies x twice without an intervening sequence point, causing undefined behavior.
Function pointers require parentheses around the pointer name: int (*func)(). Option D declares a function returning int pointer, not a function pointer.
#define is a preprocessor directive replaced before compilation, while const creates an actual variable. const occupies memory; #define does not.
#include
int main() {
int x = 5;
printf("%d", ++x + x++);
return 0;
}
The expression ++x + x++ involves modifying x multiple times without an intervening sequence point, leading to undefined behavior in C.
Static variables are initialized to 0 by default. auto and register variables have garbage values if not initialized. extern variables are declared elsewhere.
In C, the array name arr (without index) decays to a pointer to its first element, representing the base address.
Modifying and using a variable in the same expression without an intervening sequence point results in undefined behavior.