ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
#include <stdio.h>
int main(void) {
    const char *s = "hello";
    printf("%c%c", s[1], *(s + 4));
}
  1. A. he
  2. B. ol
  3. C. eo
  4. D. ll

Correct answer: C. eo

s[1] is e and *(s + 4) is the last letter o, so the output is eo.

More C Programming questions

Exams that ask this topic