A macro is something the
C
compiler not even sees.
According to the first entry in a
quick-Google-search (
Macros - The C Preprocessor[
^]):
A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro.
That is:
- macros are
C
preprocessor stuff. - Using Google you may find a lot of documentation about.
In any case here you are a simple (silly, there are spectacular - and cryptic - usages of macros) example:
#define BUFSIZE 100
int buf[BUFSIZE];
if (k>BUFSIZE)
{
}
the preprocessor replaces every occurrence of the macro
BUFSIZE
with the number
100
, thus the
C
compiler parses (something like) the following source:
int buf[100];
if (k>100)
{
}