Discussion
What is the essential difference between typedef and a #define macro for naming a type ?
Answer: C
Correct answer: typedef is handled by the compiler and respects scope, while #define is a textual substitution by the preprocessor
Because typedef is part of the language proper it obeys the usual scoping rules and handles complex declarations correctly. A macro merely pastes text, which is why a #define for a pointer type applies the star to only the first name in a multiple declaration.
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