spiderling66
Programmer
anyone can help me, what does #define eg_H mean in the header file? and what action of preprocessor work on it?
the sections of code can be inserted by #include, but in the output of the preprocessor, does output contain these two /* prog.c */ and # include "eg.h" ?
the code is showing below:
/* eg.h */
#ifndef eg_H
#define eg_H
#define N 10
#define mymax(a,b) a > b ? a : b
# endif
-------------------------------------------
/* prog.c */
#include "eg.h"
main()
{
int a[N] ;
int maxa ;
int i ;
arrayInput (a , N);
maxa = a[0];
for ( i = 1; i < N; i++)
{
maxa = mymax ( maxa, a);
}
printf("maxa = %d\n", maxa);
}
thanks
the sections of code can be inserted by #include, but in the output of the preprocessor, does output contain these two /* prog.c */ and # include "eg.h" ?
the code is showing below:
/* eg.h */
#ifndef eg_H
#define eg_H
#define N 10
#define mymax(a,b) a > b ? a : b
# endif
-------------------------------------------
/* prog.c */
#include "eg.h"
main()
{
int a[N] ;
int maxa ;
int i ;
arrayInput (a , N);
maxa = a[0];
for ( i = 1; i < N; i++)
{
maxa = mymax ( maxa, a);
}
printf("maxa = %d\n", maxa);
}
thanks