C Programming

5 Parts — 25 Chapters — From Zero to Embedded C

A structured path from writing your first C program to programming real hardware in bare-metal embedded systems. Every chapter builds on the last.

Part 1 — Getting Started
Ch 1
Introduction to C Programming
What is C, why it matters, where it is used, why embedded engineers learn it.
Ch 2
How C Programs Work
Source code → compiler → object file → executable → run.
Ch 3
Your First C Program
Writing, compiling, and running hello.c. Every line explained.
Ch 4
Variables and Data Types
Variables, memory containers, and core data types (int, float, char). Embedded memory optimization.
Ch 5
Operators in C
Introduction to the 9 types of C operators. Precedence, Associativity, and Common Mistakes. Practice Challenge.
Part 2 — Building Logic
Ch 6
if / else
Conditional branching, nested if, else-if ladder, common patterns.
Ch 7
switch case
Multi-branch selection, fall-through behavior, default case, break.
Ch 8
Loops
for, while, do-while. Nested loops, infinite loops, loop control.
Ch 9
break and continue
Exiting loops early, skipping iterations, embedded use patterns.
Ch 10
Functions
Declaring, defining, calling. Parameters, return values, scope, call by value.
Part 3 — Core C
Ch 11
Arrays
1D and 2D arrays, declaration, initialization, traversal, sizeof tricks.
Ch 12
Strings
char arrays, null terminator, string.h functions, string manipulation.
Ch 13
Pointers
Memory addresses, dereferencing, pointer arithmetic, pointers and arrays.
Ch 14
Structures
Defining structs, accessing members, nested structs, structs and pointers.
Ch 15
Union and Enum
Shared memory unions, enum constants, typedef, embedded state machines.
Part 4 — Real Programming
Ch 16
Storage Classes
auto, register, static, extern. Scope, lifetime, and visibility of variables.
Ch 17
Dynamic Memory
malloc, calloc, realloc, free. Heap vs stack. Memory leaks and best practices.
Ch 18
File Handling
fopen, fclose, fread, fwrite, fseek. Text and binary file operations.
Ch 19
Header Files
Creating .h files, include guards, separating declarations from definitions.
Ch 20
Multi-file Projects
Separate compilation, linking, extern declarations, Makefiles.
Part 5 — Embedded Focus
Ch 21
Bitwise Operators
AND, OR, XOR, NOT, shifts. Setting, clearing, toggling, reading bits.
Ch 22
Registers and Memory Mapping
SFRs, peripheral access, volatile pointer casting, register bitmasks.
Ch 23
volatile Keyword
Preventing compiler optimization. When and why to use volatile in firmware.
Ch 24
Interrupt Basics
Writing ISRs in C, volatile flags, NVIC, interrupt-safe code patterns.
Ch 25
Bare Metal Embedded C
Startup code, linker scripts, no-OS firmware, writing main() from scratch.
Chapter 1: Introduction to C →