Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@pensu-8tNeGU • Dec 5, 2011
As far as i have studied macros are preprocessor directives. Now, preprocessor directives are executed before actual compilation of the code. As you might know their value is replaced in the program before the code gets compiled. Or in simple language you can say preprocessor directives is a concept and macros are entities.
I know this is a bit ambiguous, but i hope it clears your doubt.
P.S: Correct me if i am wrong. -
@abrakadabra • Dec 5, 2011
Whoa! How will you compare these two terminologies?
A preprocessor is a program that processes its input data to produce output that is used as input to another program.
The output is said to be a preprocesed form of the input data, which is often used by some subsequent programs like compilers.
Thus, the C preprocessor handles directives for source file inclusion (#include), macro definitions (#define), and conditional inclusion (#if).
An example of Macro Expansion:
#define PI 3.1415
Above definition lets you use "PI" instead of every occurrence of 3.14159.