Q:

What is the difference between const and macro?

0

What is the difference between const and macro?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

  • The const keyword is handled by the compiler, in another hand, a macro is handled by the preprocessor directive.
  • const is a qualifier that is modified the behavior of the identifier but macro is preprocessor directive.
  • There is type checking is occurred with const keyword but does not occur with #define.
  • const is scoped by C block, #define applies to a file.
  • const can be passed as a parameter (as a pointer) to the function. In the case of call by reference, it prevents to modify the passed object value.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Embedded C interview questions and answers (2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to set, clear, toggle and checking a single bi... >>
<< What is a difference between unsigned int and sign...