Skip to main content

c basics

Pre Processor Interview Questions

Pre Processor Interview Questions

What is the use of preprocessor?

Answer: C/C++ preprocessor provides the ability for the inclusion of header files,macro substitution, conditional compilation,and line control functionality.

What do you mean by a macro, and how it works?

Answer: Macro is a simplified function in c programming language witch can be substitute with corresponding replacement data at the time of pre-processing.


 Is it better to use function or a macro?

Answer: The answer depends on the situation.
Macros are faster than functions,because their corresponding code is inserted directly into your source code at the point where the macro is called.
There is no overhead involved in using a macro when it is called like a function.However,macros are generally small and cannot handle large,complex coding constructs.
When we having complex code using control flow statements then better to use functions.
Generally, you should use macros to substitute small, repeatable code sections, and you should use functions for larger coding tasks that might require several lines of code.

Comments

Popular posts from this blog

JAVA CODING STANDARD

I am here providing u some useful information regarding the JAVA programming language  standards. Hope it will be useful for u...