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

please could you throw some light on the topic. 😀

thank you.

Replies

  • Pensu
    Pensu
    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
    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.

You are reading an archived discussion.

Related Posts

This time it is not the social networking giant. It is the researchers who have created the safest Facebook Signup Page. To read more as to what security measure can...
hi friends can anyone give me some seminar topics for the electronics & communication engineering students. for both communications and elctronics
As per the old information, During the pursuit of M.Tech, you are paid a scholarship of Rs. 5000 to Rs. 9000 per month by the Government of India. This amount...
In the recent Construction Week HSE for Life conference, which was held at Doha on 4th, December, 2011, Qatar announced the arrival of the new version of the National Building...
I will start with a apologetic note, if I sound wrong anywhere; Also, asking Admins to delete the thread if they feel so. As per my thinking, we proudly say...