"Difference Between a "Macro" & "Preprocessor"?

TechyGuy

TechyGuy

@techyguy-O1Xtd9 Oct 26, 2024
please could you throw some light on the topic. 😀

thank you.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Pensu

    Pensu

    @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.
  • Ankita Katdare

    Ankita Katdare

    @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.