ProgrammingHard
unsigned char c = 0; c -= 1; printf("%d", c); What is printed?
- A. 255
- B. 0
- C. -1
- D. 256
Correct answer: A. 255
Unsigned arithmetic wraps modulo 256 for unsigned char, so 0 - 1 becomes 255.
More C Programming questions
- int m = 2147483647; printf("%d", m / 2); What is printed with a 32-bit int?
- How many subsets of the bit positions of mask 22 (binary 10110) are visited, counting the empty subset? Compute with this program. c…
- What is printed? c #include <stdio.h> int main(void) { unsigned a = 0xB6, b = 0x3C; printf("%u", a & ~b); }
- What is printed? This program tries every subset of {3, 5, 6} and prints the largest XOR of a subset (the empty subset counts as 0). c…
- What is printed? c #include <stdio.h> char g[3][4] = {"110", "010", "011"}; int fill(int r, int c) { if (r < 0 || c < 0 || r >= 3 || c >=…
- What is printed? c #include <stdio.h> #include <stdlib.h> int cmp(const void a, const void b) { const int x = a, y = b; int sx = x[0] +…