Skip to content

C Material (Beyond textbooks)

Exploring real-world C techniques beyond textbook fundamentals.


1. Misc Topics

▶ Why C++ is Not My First Choice

▶ Undefined Behaviour in C

▶ Atomic Operations

▶ Const Correctness in C

▶ Callback Design Patterns

▶ C API Design


2. Algorithms and Data Structures in C

▶ Built-in Sorting and Searching Algorithms in C: qsort() and bsearch()

▶ C Structures: Building Class-Like Objects


3. Pointers and Arrays

▶ Understanding malloc(), calloc(), realloc(), and free()

▶ Pointer Arithmetic

▶ Pointers and Array Names

▶ NULL Pointers in C

▶ Dangling Pointers in C

▶ Shallow and Deep Copy in C

▶ Function Pointers: The Foundation of Callback Functions

▶ Pointer to Pointer: Various Scenarios

▶ Generic Programming with void *

▶ Opaque Pointers in C

▶ Flexible Array Members


4. Memory Managment

▶ Memory Types in C: Stack, Heap, and Global Memory

▶ Understanding Memory Leaks in C (Some Scenarios)

▶ Stack Overflow: Why Did My Program Crash?

▶ Memory Ownership in C: Who Is Responsible for Freeing Memory?

▶ Memory Segmentation: Where Your Code and Variables Live

▶ Memory Fragmentation: When Free Memory Can't Be Used

▶ Memory Alignment & Padding in C

▶ Memory Pools: Fast and Predictable Memory Allocation


5. Embedded C Techniques

▶ Embedded C Programming vs. Conventional C Programming

▶ Understanding Lookup Tables (LUTs) in C

▶ Fixed-Point Arithmetic in Embedded C

volatile: When the Compiler Must Not Optimize

volatile is NOT thread-safe

▶ Memory-Mapped I/O

▶ Interrupts and IRQs: How Hardware Gets the CPU's Attention

▶ Watchdog Timers: Keeping Embedded Systems Alive

▶ Software Timers: Extending Limited Hardware Timers

▶ Bit Manipulation in C: Low-Level and Hardware Programming

▶ Bit Fields in C: Packing Data into Individual Bits

▶ Bit Fields vs Bit Masks in C: When Position Matters

▶ Endianness in C: Understanding Big-Endian and Little-Endian

▶ Circular Buffers: Never Run Out of Buffer Space

▶ Finite State Machines: Simplifying Complex Program Logic

▶ Recursion in Embedded Systems: A Red Zone for Stack Memory