ProgrammingHardTCS NQT · Infosys

char *s = "hello"; What is strlen(s + 2)?

  1. A. 5
  2. B. 2
  3. C. 3
  4. D. 4

Correct answer: C. 3

s + 2 points at "llo", which has three characters before the terminator. The result is 3.

More C Programming questions

Exams that ask this topic