A few months ago during an interview, I was asked how to go about implementing a boolean datatype in C. The two most common ways would to either be:
Preprocessor Macros:
#define BOOL unsigned char
Or typedefs:
typedef BOOL unsigned char;
So I was wondering what the exact benefits and trade-offs of using either preprocessor macros or typedefs are? I commonly find myself making datatypes like "uint16," (for unsigned shorts) and "ucharp," (for unsigned char pointers). Which would be best to use?
Thanks.