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:

  1. A.

    \t

  2. B.

    \n

  3. C.

    \0

  4. D.

    \1

  5. 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.

Explore the full course: Up Lt Grade Assistant Teacher 2025