Govt. Exams
Entrance Exams
strlen() counts characters before the null terminator. "C2025" has 5 characters, so strlen returns 5. The null terminator is not counted.
Array access by index is O(1) because arrays use contiguous memory allocation, allowing direct access via base address + offset calculation.
char name[50] allocates exactly 50 bytes. The null terminator '\0' must fit within this 50-byte allocation.
In C, strings are null-terminated character arrays. The null character '\0' marks the end of the string.
Global arrays in C are automatically initialized to 0 by default. Only local arrays contain garbage values.
A 2D array with dimensions 3x4 has 3*4 = 12 total elements.
strcpy() copies the contents of the source string to the destination string.
Array names are constant pointers and cannot be reassigned. Direct assignment to char array after declaration is invalid.
strlen() returns the length of the string excluding the null terminator '\0'. "Hello" has 5 characters.
In C, arrays are declared with the syntax: datatype arrayname[size]. Option A follows the correct syntax.