Thread: i love C++
View Single Post
  #2 (permalink)  
Old November 19th, 2004, 05:20 PM
davekw7x davekw7x is offline
Authorized User
 
Join Date: Feb 2004
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Code:
jfdklsajfds x;
printf("sizeof(x) = %d\n", sizeof(x));
Regards,

Dave
Reply With Quote