- Topics - 2
- Replies - 72
- Total Posts - 74
The code works because ItemList is defined as an array of TW_UINT8, but an enumeration or array can store different types. In the example it is TWTY_UINT16 which is twice the size of TW_UINT8, hence the *2.
A better way would be to casting the address of ItemList to the stored type and then indexing that.
valueU16 = ((pTW_UINT16)(&pvalEnum->ItemList))[index];