Govt. Exams
Entrance Exams
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.
Parentheses () have the highest precedence among all operators in C. They are always evaluated first in any expression.
The strlen() function returns the length of a string as an int value, representing the number of characters.
Variable names in C must start with a letter or underscore, not a digit. _variable is valid. '2var' starts with digit, 'var-name' contains hyphen (invalid), 'var name' contains space (invalid).
The stdio.h header file contains declarations for standard input/output functions like printf() and scanf().
strlen() returns the length of a string without counting the null terminator ('\0'). For example, strlen("hello") returns 5, not 6.
int a = 10, b = 20;
int c = (a > b) ? a : b;
printf("%d", c);
The ternary operator (condition ? true_value : false_value) evaluates the condition (a > b). Since 10 is not greater than 20, it returns b which is 20.
void is used in two contexts: (1) as a function return type when a function doesn't return a value, and (2) to declare a generic pointer (void *) that can point to any data type.
char arr[10];
Each char occupies 1 byte in memory. An array of 10 chars will occupy 10 × 1 = 10 bytes.