Question 5
Back to Exercise
What is the output of the following C program?
#include <stdio.h>
int main(void) {
printf("%c %d %x %#o %#X\n", 66, 'a', 255, 8, 255);
return 0;
}
- A B 97 ff 010 0XFF Correct
- B 66 a ff 10 FF
- C B 97 FF 010 0xff
- D B a ff 8 0XFF
Correct Answer: Option A
%c prints the character with code 66; %d prints the code of 'a'; %x is lowercase hex; # adds a leading 0 to octal and 0X to uppercase hex.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!