engineering computer science MCQ #2133

What is the output of `char str[] = 'Hello'; printf('%s', str + 2);`?

engineering computer science MCQ #2133

  1. Question 1

    Q1. What is the output of `char str[] = 'Hello'; printf('%s', str + 2);`?

    • A) Hello
    • B) llo
    • C) He
    • D) ll

    Answer: llo

    Explanation: Pointer arithmetic moves the starting point of the string to 'l', so it prints 'llo'.