Entrance Exams
Govt. Exams
C uses row-major order. The entire array is contiguous in memory with all of row 0, then row 1, then row 2, etc.
strcmp() is case-sensitive. ASCII value of 'A' (65) is less than 'a' (97), so it returns negative value. But 'A' < 'a', so it returns -32 (negative).
strcpy() doesn't check destination buffer size, potentially causing buffer overflow. Modern alternatives include strncpy() or strcpy_s().
A 2D array with dimensions [4][5] contains 4 × 5 = 20 elements total.
char str[20] allocates 20 bytes on stack. char *str only declares a pointer and requires separate memory allocation (malloc/static string).
C doesn't perform bounds checking. Accessing out-of-bounds memory causes undefined behavior and is a common source of bugs.
The syntax char *str[5] declares an array of 5 pointers, each pointing to a character (or string). The brackets bind tighter than asterisk.
Option A is valid - 2D arrays can be initialized with all elements in a single brace. Options B and C are invalid as at least one dimension must be specified.
'Hello' has 5 characters plus 1 null terminator (\0), making total 6 bytes.
Array names decay to pointers to their first element in most contexts. 'arr' is equivalent to &arr[0] and cannot be reassigned.