ProgrammingVery hard
printf("%5.3s|", "abcdef"); What is printed?
- A. abcde|
- B. abcd|
- C. abc|
- D. abcdef|
Correct answer: C. abc|
The precision .3 keeps three characters, and the width of five pads them on the left with two spaces.
More C Programming questions
- printf("%d", 7 & ~2); What is printed?
- printf("%d", (1 << 4) | (1 << 2)); What is printed?
- printf("%d", 0x80 >> 7); What is printed?
- int x = 5; x ^= x << 1; printf("%d", x); What is printed?
- printf("%d", (3 & 1) + (3 | 1) + (3 ^ 1)); What is printed?
- unsigned int x = 0xF0F0F0F0u; printf("%u", x >> 28); What is printed?