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;

  1. A.

    D

  2. B.

    DMAZING

  3. C.

    ZING

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

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs