The #define compiler directive seems rather strange to me. I have read that no memory is allocated to it .
#include <iostream>
#define test 50
int main()
{
cout<<test;
return 0;
}
The above function displays 50 even though no memory is allocated to the compiler directive #define
How does compiler know that 50 is stored in it (test) without having any memory.
Macros are not the same thing as variables.
Your compiler will translate the program
to
by replacing the name
test
by its value given at your#define
statement. You might want to take a look at some tutorials you can find on the internet e.g.: