Question.2
A simple config struct with no pointers is copied:
struct GpioConfig { uint8_t port; uint8_t pin; uint8_t mode; }; GpioConfig cfg1 = {2, 5, 1}; GpioConfig cfg2 = cfg1; cfg2.mode = 0; printf("%d", cfg1.mode);
What is the output?
Select Answer
1 -- the default copy creates an independent memberwise copy; modifying cfg2 does not affect cfg1
0 -- both share the same data
Undefined -- structs cannot be copied
Compilation error