Govt Exams
The const keyword is used in C to declare a constant variable whose value cannot be modified after initialization. Variables declared as const are read-only.
The & operator has two uses in C: (1) When used before a variable, it returns the memory address of that variable (address-of operator), and (2) When used between two integers, it performs a bitwise AND operation.
C does not have a built-in boolean data type. The other options (float, double, char) are all valid primitive data types in C. Boolean functionality is typically implemented using int (0 for false, non-zero for true).
On most modern 32-bit and 64-bit systems, an int is typically 4 bytes (32 bits). However, the exact size can vary depending on the compiler and system architecture.
Static variables are initialized only once and retain their value throughout the program execution. Their value persists between function calls.
ptr is reassigned to point to b. When we dereference ptr using *ptr, we get the value stored at b, which is 10.
Linear search checks each element sequentially. In the worst case, it needs to check all n elements, resulting in O(n) time complexity.
ptr[2] is equivalent to *(ptr+2), which dereferences the pointer and returns the value at the third element (index 2).
The pre-increment operator (++x) increments x from 5 to 6 before using its value in printf(). So the output is 6.
To explicitly declare a function with no parameters in C, use 'void' as the parameter. int func(); is ambiguous in older C standards.