|
Subject:
|
i love C++
|
|
Posted By:
|
ealkurabi
|
Post Date:
|
11/19/2004 11:48:02 AM
|
hmm i wonder its a newbie question but to define a variable like for example. #define "jfdklsajfds" USHORT can i like make a USHORT2 or something? like i can abbreviate howwver i want? just a simple quesiton srry to bother just itching at my brain.
thank you
|
|
Reply By:
|
davekw7x
|
Reply Date:
|
11/19/2004 4:20:41 PM
|
The general form is
#define symbolic_constant value
Where symbolic_constant is any valid C or C++ identifier (alphanumeric, first char is alpha, underscore counts as alpha, etc.)
The preprocessor will substitute the value for the symbolic_constant before handing the program to the compiler.
#define jfdklsajfds USHORT
only makes sense if USHORT is known to the compiler by the time jfdklsajfds is used in the program. Then, anywhere you use jfdklsajfds, it is af you had used USHORT
jfdklsajfds x;
printf("sizeof(x) = %d\n", sizeof(x));
Regards,
Dave
|