Strings are character arrays. The last index of it contains the…
2015
Strings are character arrays. The last index of it contains the null-terminated character:
- A.
\t
- B.
\n
- C.
\0
- D.
\1
- E.
Question not attempted
Attempted by 939 students.
Show answer & explanation
Correct answer: C
In C-style strings, characters are stored in an array, and the string ends with a null character (\0). This null character indicates the end of the string to functions that process it. The null character is represented as \0, which is a single byte with value 0. It is not visible and does not print anything. Other escape sequences like \t (tab) and \n (newline) are used for formatting and do not terminate strings. Therefore, the last index of a string array contains \0 to mark the end of the string.