ProgrammingVery hardProduct company OA

On an LP64 system (32-bit int, 64-bit long), what is printed?

On an LP64 system (32-bit int, 64-bit long), what is printed?
printf("%zu %zu", sizeof(2147483647), sizeof(2147483648));
  1. A. 4 overflow error
  2. B. 4 8
  3. C. 4 4
  4. D. 8 8

Correct answer: B. 4 8

An unsuffixed decimal constant takes the first of int, long, long long that can hold it. 2147483647 is INT_MAX and fits in int (4 bytes); 2147483648 does not, so it becomes a long (8 bytes). It never silently overflows.

More C Programming questions

Exams that ask this topic