Select the correct output of the following C++ program segment assuming all necessary header files are correctly included.
Select the correct output of the following C++ program segment assuming all necessary header files are correctly included.
void main ()
{
char *S = "Inheritance";
S +=6 ;
cout<<S<< endl;
}
Show answerHide answer
Correct answer: (B) tance
Explanation
S points to "Inheritance". S += 6 moves it to index 6 (I0 n1 h2 e3 r4 i5 t6), so cout prints "tance".