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().
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.
Total elements = 2 × 3 × 4 = 24 elements in the 3D array.
char str[6] = {'H','e','l','l','o'};
printf("%s", str);
The array has 5 characters but is not null-terminated. printf("%s") will read beyond the array, printing garbage.
arr[0] points to the first row (array of 4 ints). arr[0][0] and *(*arr) both access the first element through pointer dereferencing.
arr[5] accesses the element at index 5 (6th element), while *arr (equivalent to arr[0]) accesses the first element.
char str[] = "Hello";
printf("%c", *(str+2));
str+2 points to the 3rd character (index 2). *(str+2) dereferences it, printing 'l'.