Machine-translated by Google. Questions are authored in English.
Top

Discussion

One of the major difference between typedef and #define is that typedef interpretation is performed by the _________________ whereas #define interpretation is performed by the _____________

  • A.pre-processor, compiler
  • B.user, pre-processor
  • C.compiler, pre-processor
  • D.compiler, user

Answer: C

Correct answer: compiler, pre-processor

#define is handled by the preprocessor, which performs blind textual substitution before compilation begins and understands nothing of types or scope. typedef is processed by the compiler itself, so it obeys scope rules and creates a genuine type alias. This is why #define intptr int * and typedef int *intptr; behave differently when several variables are declared on one line.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.