- #1
TheAnalogKid83
- 174
- 0
I'm sorry if this question is asked a million times, but I'm trying to see the difference between defining a macro and defining a variable. I know that defining a macro allows for many other things that a variable can't do but I see lots of examples of people doing something like this:
#define twofiftysix 256;
so where ever the program code actually uses this number macro, won't it be essentially be a static variable??
after trying to understand this I start to wonder how a compiler uses just numbers like
int variable;
if (variable > 5) then
{variable = 0;
}
don't the numbers 5 and 0 need to be stored as variables in the memory for them to be referenced while the program is running?
does the compiler automatically generate these numbers as static variables?
#define twofiftysix 256;
so where ever the program code actually uses this number macro, won't it be essentially be a static variable??
after trying to understand this I start to wonder how a compiler uses just numbers like
int variable;
if (variable > 5) then
{variable = 0;
}
don't the numbers 5 and 0 need to be stored as variables in the memory for them to be referenced while the program is running?
does the compiler automatically generate these numbers as static variables?