Question.2
A developer configures a UART peripheral via a pointer to a struct:
typedef struct { uint32_t baud; uint8_t parity; } UART_Config; UART_Config cfg = {9600, 1}; UART_Config *ptr = &cfg; ptr.baud = 115200;
What is wrong?
Select Answer
Nothing — dot notation works on struct pointers
ptr is a pointer — it requires arrow notation: ptr->baud = 115200
ptr
ptr->baud = 115200
baud is const and cannot be modified
baud
const
ptr must be cast to (UART_Config*) before access
UART_Config*