Question 11
Back to Exercise
Is it valid to write typedef int Id; twice in the same scope?
- A Never
- B Yes since C11, provided both name exactly the same type Correct
- C Only in different files
- D Only with extern
Correct Answer: Option B
C11 allows a typedef to be redeclared if it denotes the same type, which makes it easier for several headers to provide the same alias. A different type for the same name is still an error.
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!