static
Preserves a variable’s value between function calls. If used globally, it limits the variable’s scope to that specific file only
Volatile
Tells the compiler the variable can change unexpectedly (e.g., a hardware register or a value changed in an ISR). Prevents the compiler from optimizing it away.
Extern
Declares a variable or function that is defined in a different file, allowing it to be used across the whole project.
Const
Declares a variable as “read-only.” In embedded, this often ensures the data is stored in Flash (ROM) memory rather than RAM.
Register
A hint to the compiler to store the variable in a CPU register for faster access (rarely used in modern compilers but good to know).
Struct
Groups different types of variables together under one name (e.g., a “Sensor” struct with ID and Value).
Union
Similar to a struct, but all members share the same memory location. Used to save space or view the same data in different ways (like a float as 4 bytes).
typedef
Creates a nickname for a type (e.g., typedef unsigned char uint8_t;). Makes code much more readable.
enum
Defines a list of named integer constants (e.g., enum State {IDLE, RUNNING, ERROR}).
sizeOf
An operator that returns the size of a data type or variable in bytes.
break
Immediately exits the current loop or switch statement.
Continue
Skips the rest of the current loop iteration and moves to the next one.
Switch/Case/Default
A cleaner way to write multiple if-else statements based on a single integer value.
do / while
A loop that is guaranteed to run at least once before checking the condition.
goto
Jumps to a labeled part of the code (generally discouraged, but sometimes used in embedded for centralized error handling).
void
Means “nothing.” Used for functions that don’t return anything or for “generic” pointers (void *).
unsigned
Means “nothing.” Used for functions that don’t return anything or for “generic” pointers (void *).
signed
The default; allows for both positive and negative values.
short / long
Modifiers to decrease or increase the memory size of an integer.