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));- A. 4 overflow error
- B. 4 8
- C. 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
- What is printed? c printf("%d %d", '0', '0');
- What is printed? c printf("%d %d", !!"", !"");
- How many subsets does this code count? c int a[] = {2, 3, 5, 7, 8}, c = 0; for (int m = 0; m < 32; m++) { int s = 0; for (int i = 0; i <…
- What is the type of the result of subtracting two int pointers, p - q?
- What is printed? c char s[] = "xya", p = s; char a = p++; char b = ++p; char c = ++p; printf("%c%c%c %s", a, b, c, s);
- What is printed? c int hs(unsigned n) { return n ? (n & 0xF) + hs(n >> 4) : 0; } int main(void) { printf("%d", hs(0xBEEF)); }