ProgrammingHard

printf("%s", (char[]){'h', 'i', '\0'}); What is printed?

  1. A. h
  2. B. hi
  3. C. hi\0
  4. D. ih

Correct answer: B. hi

The compound literal is a char array with a terminator, so printing it gives hi.

More C Programming questions

Exams that ask this topic