In my book, it says that the syntax for #define is
However, I've seen lots of code like this:Code:#define macro_name macro_body
What does exp. 2 mean?Code:#define macro_name
In my book, it says that the syntax for #define is
However, I've seen lots of code like this:Code:#define macro_name macro_body
What does exp. 2 mean?Code:#define macro_name
the working of both r similar.
1. #define MACR0 10
what this does is it replaces the word MACRO with 10 everywhere in the programme.
This is used from the clarity of the programme.
2. # define MACRO
here u r just defining a macro
it acts like an if.
ex.
#ifdef MACRO
printf(....)
#else
printf(....)
That makes sense. I can see lots of ways to use that. Thanks.