ProgrammingHardProduct company OA

What is printed?

What is printed?
const char *s = "ab\
cd";
printf("%zu", strlen(s));
  1. A. 5
  2. B. Compilation error
  3. C. 4
  4. D. 6

Correct answer: C. 4

A backslash immediately followed by a newline is deleted in an early translation phase, splicing the two lines into one: the literal is just "abcd", 4 characters. Neither the backslash nor the newline ends up in the string.

More C Programming questions

Exams that ask this topic