84. Structures-iii

Question.5

A developer writes a function to update a sensor config:

typedef struct {
   uint16_t rate;
   uint8_t  bits;
   uint8_t  channel;
} ADC_Config;

void update_config(ADC_Config cfg) {
   cfg.rate = 500;
   cfg.bits = 10;
}

ADC_Config my_cfg = {1000, 12, 3};
update_config(my_cfg);
printf("%d", my_cfg.rate);

What is the output?

Need Help? Refer to the Quick Guide below

Select Answer

Restart quiz!