I am trying to understand the offset value of the c struct such as below:
typedef struct
{ /* offset */
uint32_t MODER; /* 0x00 */
uint32_t OTYPER; /* 0x04 */
uint32_t OSPEEDR; /* 0x08 */
uint32_t PUPDR; /* 0x0C */
...
}GPIO_regDef_t;
GPIO_RegDef_t *pGPIOB = (GPIO_RegDef_t*) 0x40000000;
When storing 44 to OTYPER in such way
pGPIOB->OTYPER = 44;
how does the compiler know it is writing to the address of
*(0x40000000 + 0x04) ?
In other words I don't understand the relationship between Uint32 and 0x04.
Could someone please explain?
Thanks,