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 = "MySQL";
S += 2;
cout << S <<endl;
}
Show answerHide answer
Correct answer: (A) SQL
Explanation
S points to "MySQL". S += 2 moves it past 'M' and 'y' to 'S', so cout prints the string from there: SQL.