Question: In an embedded system, define a structure `SensorNetwork` that represents a network of sensors, where each sensor is represented by a `SensorNode` structure containing pointers to its neighbors and a nested `SensorData` structure that contains dynamically allocated sensor readings. Write a C program that:
→ Initializes a network of sensors, allowing dynamic addition of nodes and updating of sensor data.
→ Implements functions to simulate data transmission between nodes, ensuring that data is correctly propagated through the network.
→ Discuss the challenges of managing memory in this scenario, particularly with regard to real-time constraints, alignment, and potential padding issues in an embedded environment.
Here are four challenging interview questions focused on structure alignment, padding, and packing in C. These questions are designed to assess the candidate's understanding of how data structures are organized in memory and how to manipulate that organization effectively.