Explain the Macros?
Preprocessor' is a translation stage that is applied to your source code before the compiler proper gets its hands on it. Usually the preprocessor performs textual substitutions on your source code. Macro is a kind of preprocessor which replaces instances of one piece of text with another.
A preprocessor line of the form
#define name text
defines a macro with the given name having as its value the given substitute text. After that for the rest of the current source file someplace the preprocessor sees that name, it will replace it with the replacement text. The name follows the similar rules as ordinary identifiers it can contain only letters, digits, and underscores, and may not begin with a digit. Ever since macros behave quite differently from normal variables or functions it is customary to give them names which are all capital letters or at least which begin with a capital letter. The replacement text is able to be absolutely anything--it's not restricted to numbers, or anything, or simple strings.
The mainly common use for macros is to propagate various constants around and to make them more self-documenting. We have been saying things like
but this is neither reliable nor readable it's not essentially obvious what all those 100's scattered around the program are and if we ever decide that 100 is too small for the size of the array to hold lines we'll have to remember to change the number in two or more places. A lot better solution is to use a macro:
#define MAXLINE 100
Now if we still want to change the size we only must do it in one place. The macro text MAXLINE is known as a symbolic constant.