What is difference between using a macro and a in line function?



What is difference between using a macro and a in line function?..

Answer / Vinod Mishrwan

The main differences between macros and inline functions are:
1. Syntax: Macros are defined using the preprocessor directive #define, while inline functions are declared with the keyword inline.
2. Control flow: Inline functions follow regular C function semantics and have control over their input/output parameters, whereas macros don't have such control due to their textual replacement during the preprocessing stage.
3. Code generation: The compiler has more control over the optimization of inline functions compared to macros.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Embedded Systems AllOther Interview Questions

Tell me what is the function of dma controlled in embedded system?

1 Answers  


Show me a portfolio of all the applications you worked on, and tell me how you contributed to design them.

1 Answers  


How do the mvp, mvc, and mvvm patterns relate?

1 Answers  


What is the repository pattern? Why are patterns important?

1 Answers  


How many types of ipc mechanism you know?

1 Answers  


How does combination of functions reduce memory requirements in embedded systems?

1 Answers  


Tell me is count down_to_zero loop better than count_up_loops?

1 Answers  


Explain me what is spin lock?

1 Answers  


Explain some of the commonly found errors in embedded systems?

1 Answers  


Explain me why is model transformations used in the embedded system?

1 Answers  


Describe the structure and contents of a design document, or a set of design documents, for a multi-tiered web application.

1 Answers  


What is risc architecture?

1 Answers  


Categories