ProgrammingVery hardProduct company OA

What is printed?

What is printed?
printf("%zu", sizeof("\1234"));
  1. A. 2
  2. B. 5
  3. C. 3
  4. D. 6

Correct answer: C. 3

An octal escape takes at most three octal digits, so \123 is one character ('S' in ASCII) and the 4 that follows is a separate character. Two characters plus '\0' make 3 bytes. '2' reads all four digits as one escape.

More C Programming questions

Exams that ask this topic