Select the correct output of the following code: char *s = "AMAZING"; s += 3;…
2017
Select the correct output of the following code: char *s = "AMAZING"; s += 3; cout << s << endl;
- A.
D
- B.
DMAZING
- C.
ZING
- D.
Z
Attempted by 246 students.
Show answer & explanation
Correct answer: C
Correct answer: ZING Explanation: Start with the string literal "AMAZING" stored as a null-terminated array: indices are 0:'A', 1:'M', 2:'A', 3:'Z', 4:'I', 5:'N', 6:'G', 7:'\0'.
A video solution is available for this question — log in and enroll to watch it.