Skip to content
BoKSA

C Language Fundamentals

C Language Fundamentals

Use this page to revise the C concepts firmware tests actually ask about — not a full language course.

Types and macros

Prefer stdint.h (uint8_t, int32_t). #define is textual; a function-like macro needs parentheses. const and volatile are different: volatile is for hardware and shared ISR data.

Pointers, arrays, structs

A pointer holds an address. Arrays decay to pointers. A struct groups fields; typedef names a type; union overlays storage; enum names integer constants. Alignment and padding exist.

Stack, heap, and UB

Stack frames hold locals; heap is malloc (often avoided on small MCUs). Undefined behaviour (buffer overflow, use-after-free, data races) is how firmware "works until it doesn't".

Data structures

Know array, queue/ring buffer, stack, and when a linked list is a bad idea in a tiny RAM device.

Starting Points

Key Points

  • You can choose a stdint.h type for a register, a count, and a physical quantity.
  • You can explain pointer vs. array vs. struct field access.
  • You can explain stack vs. heap and why malloc is risky on a small MCU.
  • You can explain volatile vs. const.
  • You can name a ring buffer as the usual ISR-to-main structure and why a linked list may be the wrong default.