There is an SRC variable of 16 bits, how to create two 8-bit
variables, so that one is addressed to the upper part and the second
to the lower part of the SRC variable?
type construction
uint16_t src;
uint8_t b1 = * ((uint8_t *) & src);
uint8_t b2 = * (((uint8_t *) & src) +1);
should work but at compilation produces:
MAIN.c (16): error: # 28: expression must have a constant value
uint8_t b1 = * ((uint8_t *) & src);
MAIN.c (17):
↧