Post moved to a new thread in CS/IT/Networking engineering section.sheena rewaricould you please tell me 5 difference between a macro and pre-processor??😀
Macros, which are special lines/fragments of code, differ from any other code written in the source files in the aspect that it's not passed to the compiler (either for the purpose of encoding into machine instructions, or some intermediate form instructions).sheena rewaricould you please tell me 5 difference between a macro and pre-processor??😀
Preprocessors, statements that tell the programming language to perform such task as combining source program files prior to compilation.
For ex: #define pi 3.14
This substitution is made in the pre-processing state itself where header files are included
Difference between preprocessor and macro
Preprocessor is the program that does the preprocessing like file inclusion,compilation, macro expansion. So that means lines that start with # are preprocessing directives. They are directives that tell the preprocessor to do something.
examples are - #include <header_name>
or #if <value>
macros are name for fragment of code.
e.g #define buffer_size 100
Here whenever yuo use macro buffer_size it will get replaced by value 100
A macro processor is a program that copies a stream of text from one place to another, making a systematic set of replacements as it does so. ... A preprocessor is a program that processes its input data to produce output that is used as input to another program.Macro: a word defined by the #definepreprocessor directive that evaluates to some other expression.Preprocessor directive: a special #-keyword, recognized by the preprocessor. preprocessor modifies the source file before handing it over the compiler. Consider preprocessor a program that runs beforecompiler.
Related Posts
@Kaustubh Katdare · Aug 13, 2015
@Ankita Katdare · Oct 10, 2014
@Neha Kochhar · Jan 17, 2010
@Abhishek Rawal · Aug 6, 2015
@Anil Jain · Aug 7, 2013