Macros are not the same thing as variables.
Your compiler will translate the program
#include <iostream>
#define test 50
int main()
{
cout << test;
return 0;
}
to
#include <iostream>
int main()
{
cout << 50;
return 0;
}
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.:
#define getmax(a,b) ((a)>(b)?(a):(b))
This would replace any occurrence of getmax followed by two arguments
by the replacement expression, but also replacing each argument by its
identifier, exactly as you would expect if it was a function:
// function macro
#include <iostream>
using namespace std;
#define getmax(a,b) ((a)>(b)?(a):(b))
int main()
{
int x=5, y;
y= getmax(x,2);
cout << y << endl;
cout << getmax(7,x) << endl;
return 0;
}