CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@sheena rewari • 20 Aug, 2012
could you please tell me 5 difference between a macro and pre-processor??😀
@Kaustubh Katdare • 20 Aug, 2012
sheena rewari
could you please tell me 5 difference between a macro and pre-processor??😀
Post moved to a new thread in CS/IT/Networking engineering section.
@sheena rewari • 20 Aug, 2012
sheena rewari
could 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).

Preprocessors, statements that tell the programming language to perform such task as combining source program files prior to compilation.

@Neeraj Sharma • 20 Aug, 2012 As far as I know. Macro is formed using a preprocessor #define.

For ex: #define pi 3.14

This substitution is made in the pre-processing state itself where header files are included
@varsha shaw • 02 Dec, 2018 • 1 like

Difference between preprocessor and macro

@Radhika Deshpande • 03 Dec, 2018

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

@Durgesh Srivastava • 26 Jan, 2020

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

@Reya · Nov 6, 2010

Hi friends do anybody know how to move the files and folders from one drive to another using command prompt in windows?

@chiru2218 · Jul 16, 2009

I would plz like s/w & n/wng professionals to post their views on aspects like job stress,demand for their skills,compensation,security of job,working hrs etc.Your views will be most valuable to...

@Nivedita Gautam · May 19, 2014

I m computer science student. I am about to complete my 3rd year. I am supposed to do 45 days summer internship. I want to do it in java...

@Shyamsundar · Apr 29, 2013

Hi, allIam trying to learn MATLAB. please let me know its future scope. And what are the uses and applications. It is very interesting. I know few basics.

@Naman Agarwal · Oct 4, 2013

why do ceiling fan rotates in anticlockwise direction and table fan in clockwise direction?