Discussion
typedef's have the advantage that they obey scope rules, that is they can be declared local to a function or a block whereas #define's always have a global effect.
Answer: A
Correct answer: Yes
The statement is correct, and it follows from where each is processed. A typedef is a declaration handled by the compiler, so it obeys the ordinary scope rules and one declared inside a function or block is invisible outside it. A #define is handled by the preprocessor, which knows nothing of blocks, so it applies from its definition to the end of the file or until #undef.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development