ProgrammingHardTCS NQT · Accenture

What is printed? Assume double is 8 bytes.

What is printed? Assume double is 8 bytes.
#include <stdio.h>
int main(void) {
    printf("%zu", sizeof(1 ? 'a' : 1.0));
}
  1. A. 8
  2. B. 4
  3. C. 1
  4. D. 16

Correct answer: A. 8

In the conditional, 'a' and 1.0 undergo the usual arithmetic conversions, so the result type is double, which is 8 bytes.

More C Programming questions

Exams that ask this topic