The code above are two macros used to isolate a byte of a multi-byte thing. But I'm so confused about the pointer reference and dereference process, and what's the point for using such macro? Can anyone explain to me and make a real example to demonstrate its purpose?Code:#define BYTE(thing,offset) (*(((unsigned char*)&thing)+offset)) #define WORD(thing) (*((unsigned int*)&thing))
All I can guess base on my knowledge is that:
Thanks.Code:unsigned int b = 9, a; a = WORD(b); // a = 9