Question: how c interact with hardware?
Answer: There are two basic mechanisms for interacting with the hardware: The hardware can use interrupts to tell the CPU that something has happened. The CPU stops whatever it is doing and executes a short piece of code to handle the interrupt. ... It is possible to install a C function as an interrupt handler.