rs_1915
asked on
use #define to name variable
I am trying to name the variable using define
example #define ADDLETTER(a) will add letters 'td' to a, and declare this variable with that name.
So, If i declare int ADDLETTER( a); compiler should compile it as int tda;
second example
int ADDLETTER( bc );
the compiler will compile as
int tdbc;
Is this even possible to do?
example #define ADDLETTER(a) will add letters 'td' to a, and declare this variable with that name.
So, If i declare int ADDLETTER( a); compiler should compile it as int tda;
second example
int ADDLETTER( bc );
the compiler will compile as
int tdbc;
Is this even possible to do?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Never mind what those guys say. I suggest using the token-pasting operator, ##
-- Dan
-- Dan
:o)
#define ADDLETTER(a) td##a