Question.1
A driver reads a sensor value through a pointer. If the sensor is offline, the pointer is NULL:
NULL
int *sensor_val = get_sensor_ptr(); int reading = *sensor_val + offset;
What happens if get_sensor_ptr() returns NULL?
get_sensor_ptr()
Select Answer
reading is 0 + offset
Undefined behavior — dereferencing NULL is a crash or hard fault on most MCUs
reading is NULL + offset
The compiler optimizes the NULL dereference away