Macros


Macros are built on the #define preprocessor.

Normally a #define would look like:

	#define PI 3.142
But, a macro would look like this.
	#define SQUARE(x) x*x
The main difference is that the first example is a constant and the second is an expression. If the macro above was used in some code it may look like this:
        #define SQUARE(x)  x*x

        main()
        {
          int value=3;
          printf("%d \n", SQUARE(value));
        }
After preprocessing the code would become:
        main()
        {
          int value=3;
          printf("%d \n", value*value);
        }

Examples:

macro example.


Notes:


See Also:


Top Master Index Keywords Functions


Martin Leslie