C dominates embedded firmware: microcontrollers with kilobytes of RAM, no OS, and direct hardware register access. Compare with high-level JavaScript where hardware is abstracted away.
Embedded traits
- Bare-metal or RTOS (FreeRTOS, Zephyr)
- Fixed-width types from
<stdint.h> volatilefor memory-mapped I/O- Cross-compilers targeting ARM, RISC-V, AVR
Hello blink (conceptual)
volatile uint32_t *GPIO = (uint32_t *)0x40020000;
*GPIO |= (1u << 5); /* set pin — address from datasheet */
Important interview questions and answers
- Q: Why C for MCUs?
A: Predictable code size, direct hardware control, mature toolchains. - Q: Stack size concerns?
A: RAM is tiny—avoid large stack arrays and deep recursion.
Self-check
- What keyword marks hardware registers that change asynchronously?
- Why use uint32_t in firmware?
Interview prep
- Why C on MCUs?
Predictable code size, direct register access, mature vendor toolchains, and no GC overhead.