Important MCQ

Index of the first character of a string is

Q.Index of the first character of a string is

A) 2
B) 1
C) 0
D) -1
Correct Answer:
Option C
Detailed Explanation:
C) 0 is correct. The string class is provided by . String indexes start at 0; length() and size() report character count, substr extracts part of a string, and getline reads spaces.