Question 7
Back to Exercise
What is the output of the following C program on a 64-bit system?
#include <stdio.h>
typedef int Number;
int main(void) {
printf("%zu ", sizeof(Number));
{
typedef double Number;
printf("%zu ", sizeof(Number));
}
printf("%zu\n", sizeof(Number));
return 0;
}
- A 4 8 4 Correct
- B 4 8 8
- C 8 8 8
- D Compilation error
Correct Answer: Option A
The inner typedef has block scope and hides the outer one only inside the braces. After the block, Number is int again.
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!