A pointer to a pointer is declared using two asterisks (). int ptr declares a pointer that points to another pointer that points to an integer.
Both {} and {0} will initialize all array elements to 0. When you provide fewer initializers than array size, remaining elements are automatically set to 0.
struct Point { int x; char c; int y; }
Due to memory alignment/padding: int x (4 bytes), char c (1 byte) + 3 bytes padding, int y (4 bytes) = 12 bytes total. The compiler adds padding to align data members to their natural boundaries for efficient memory access.
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.