ProgrammingHardTCS NQT · Infosys · Product Company SDE
What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits)? #include <stdio.h> int main(void) { unsigned int u = 25; u -= 57; printf("%u %d", u, u > 100); return 0; }
- A. -32 1
- B. 32 1
- C. -32 0
- D. 4294967264 1
Correct answer: D. 4294967264 1
Unsigned arithmetic wraps modulo 2³²: 25 − 57 = 4294967264 (4294967296 − 32), which is greater than 100, so the comparison prints 1.
More C Programming questions
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits)? #include <stdio.h>…
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits)? #include <stdio.h> int…
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits)? #include <stdio.h> int…
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits)? #include <stdio.h> int…
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits)? #include <stdio.h>…
- What is the output of this C program (assume a typical 64-bit platform: int 32 bits, long and pointers 64 bits)? #include <stdio.h> int…