ProgrammingHard

char s[] = "hello"; char *p = s; while (*p) { if (*p == 'l') *p = 'L'; p++; } printf("%s", s); What is printed?

  1. A. heLLo
  2. B. hexLo
  3. C. heLLa
  4. D. heLLos

Correct answer: A. heLLo

Each l is replaced in place by L, and the loop stops at the terminator. The h and o are unchanged.

More C Programming questions

Exams that ask this topic