Using define with variable values



The following line of code works, however, since my professor is a real
purist of c, I would like to know if this code is valid (is it good
code or a piece of crap?):
#define DMP_FILE argv[argc-1]

This would be use to do something like this:
void main(int argc,char *argv[])
{
FILE *p2file=fopen(DMP_FILE,"w");
}

Is this a macro? Cause in the examples of macro I've studied, variables
were involved in the macro itself. This would be like a regular define,
but with variable values.

.



Relevant Pages