ProgrammingHardProduct company OA

With 4-byte int, what is printed?

With 4-byte int, what is printed?
int x = 7;
printf("%zu %zu", sizeof (int) * 3, sizeof x + 1);
  1. A. 4 5
  2. B. 4 8
  3. C. 12 5
  4. D. 12 4

Correct answer: C. 12 5

sizeof (int) is a complete operand, so the expression is (sizeof(int)) * 3 = 12. sizeof is a unary operator binding tighter than +, so sizeof x + 1 = 4 + 1 = 5, not sizeof(x + 1).

More C Programming questions

Exams that ask this topic