I have a structure defined as
struct typeEEDevConf {
unsigned long EEulng52modCfg;
unsigned long EEAulngA[5];
unsigned int EEAuintM[5];
unsigned int EEAuintB[5];
unsigned char EEuchrDispIntensity;
unsigned char EEuchrTopDispIndex;
unsigned char EEuchrBtmDispIndex;
unsigned char EEAuchrDisplayParams[16];
unsigned int EEuintDispUpdateRate;
unsigned char EEuchrWaveType;
struct typePIConst EEudtPIConst;
struct typePWMCtrl EEudtPwmCtrl;
unsigned char End; //only used to get address of end of struct
};
struct typeEEDevConf EEDevConf;
There is a discrepency in size of this structure. Manually counted, I get 60 bytes (where 1byte = 16bit). The sizeof(EEDevConf) operator returns 62 bytes. If I take the difference of the start and end address of the structure, I get 61. ie (&EEDevConf.End - &EEDevConf + 1 = 0x61, the +1 is to account for the size of EEDevConf.End).
After some digging, I find that there is a byte in between EEuchrWaveType & EEudtPIConst. ie:
&EEDevConf.EEuchrWaveType = 0x912A
&EEDevConf.EEudtPIConst = 0x912C
What happened to memory at 0x912B? I find the value at 0x912B to be: *((char *)0x912B) = 0xA042.
You may ask why it matters. The reason is because I have external EEPROM chip that I copy this entire structure to, so I have to account for every byte.