C CLP study plan
C CLP · Give each week a clear focus.
8 weeks · About 6 hours per week
Pointers and Arrays & Data Types, Declarations, and Type Conversions
Trace pointer arithmetic on int, char, and struct arrays by hand and then verify each prediction by compiling and printing addresses and offsets.
Distinguish pointer-to-T, array-of-T, and pointer-to-array-of-T in declarations, and write a one-page decision table you can consult later.
Explain and demonstrate array-to-pointer decay, including the cases where sizeof and & suppress it.
Diagnose the difference between const T *, T * const, and const T * const by writing four declarations and predicting which assignments fail to compile.
Your checkpoint
A 40-line C file plus a comment block in which every pointer/array expression is predicted before compilation and marked correct or corrected afterward, with at least 10 predictions.
Pointers and Arrays & Dynamic Memory Management
Implement a dynamically sized integer buffer using malloc, realloc, and free, handling allocation failure at every call site.
Identify and fix a double free, a use-after-free, and a memory leak that you deliberately introduce in three small programs.
Compare malloc, calloc, and realloc semantics for zero sizes, shrinking, and failure, and record what your implementation actually does.
Build and run at least one program under a sanitizer (AddressSanitizer or Valgrind) and interpret the reported diagnostics.
Your checkpoint
A working growable buffer module with a test driver that exercises growth, shrink, failure injection, and cleanup, plus sanitizer output showing a clean run and a deliberately broken run.
Functions, Scope, Storage Duration, and Linkage & Data Types, Declarations, and Type Conversions
Classify every variable in a multi-file program by scope, storage duration, and linkage, and justify each classification in writing.
Build a three-file program that links successfully using extern and a header with include guards, then deliberately create and resolve an undefined-reference and a multiple-definition error.
Explain the difference between static at file scope and static at block scope with a runnable example of each.
Demonstrate implicit and explicit integer conversions, including integer promotion in expressions and narrowing on assignment, and predict each result before running.
Your checkpoint
A three-file program with a header, a written linkage table for all identifiers, and a log of the exact compiler and linker diagnostics produced by two deliberate errors plus their fixes.
Program Structure, Compilation, and Preprocessing & Operators, Expressions, and Evaluation Order
Walk through the translation phases from source file to executable and name the artifact produced at each stage.
Write and debug macros that use argument parentheses correctly, plus one function-like macro that cannot be written safely and an inline function replacement.
Use conditional compilation and predefined macros to produce a build that reports its own configuration at runtime.
Predict evaluation order and sequence points in expressions involving &&, ||, ?:, comma, and function-call arguments, and rewrite any undefined expression into a well-defined one.
Your checkpoint
A single project with a header of at least five macros (including one variadic or stringizing macro), a build that prints its configuration, and a written before/after table of 10 expression evaluations with undefined cases rewritten.
Operators, Expressions, and Evaluation Order & Control Flow and Statements
Implement each loop form and rewrite the same loop as for, while, and do-while, stating when the do-while differs observably.
Use switch with fallthrough intentionally and demonstrate the effect of a missing break, then refactor to remove accidental fallthrough.
Implement a small state machine using switch and an enum, and verify it against a table of transitions.
Explain short-circuit evaluation side effects and write a test that proves the right operand is not evaluated when the left determines the result.
Your checkpoint
A menu-driven state machine program of at least 100 lines with a transition table in comments and a test log covering every transition, including invalid input.
Strings and Character Handling & Structures, Unions, Enumerations, and Bit-fields
Implement strlen, strcpy, and strcmp from scratch using only pointer traversal, then compare behavior with the standard library on empty, boundary, and non-terminated inputs.
Distinguish char, signed char, and unsigned char behavior for values above 127 and demonstrate the difference with ctype functions and integer promotion.
Design a struct with padding, predict its size and member offsets, verify with offsetof and sizeof, then reorder members to reduce size.
Use a union for type punning safely via memcpy and demonstrate one unsafe alternative with its observable failure.
Declare and manipulate a bit-field struct, and verify its layout and masking behavior with printed values.
Your checkpoint
A string utility file with three hand-written functions plus a struct/union/bit-field layout report showing predicted versus actual sizes, offsets, and byte dumps for at least three types.
Standard Library Usage and File I/O & Dynamic Memory Management
Read and write text and binary files using fopen modes, fread, fwrite, fseek, and ftell, and explain the difference between text and binary translation.
Handle and report I/O errors by checking return values and using ferror and feof correctly, distinguishing EOF from a read error.
Use qsort and bsearch with a comparator function, including a comparator that sorts structs by two keys.
Combine dynamic allocation with file input by reading a file of unknown length into a heap buffer with no fixed maximum.
Your checkpoint
A command-line program that reads a binary or text file of unknown size into dynamic memory, sorts records with qsort, writes results to an output file, and reports errors with nonzero exit codes; includes a test script with at least five cases.
Program Structure, Compilation, and Preprocessing & Data Types, Declarations, and Type Conversions & Operators, Expressions, and Evaluation Order & Control Flow and Statements & Functions, Scope, Storage Duration, and Linkage & Pointers and Arrays & Strings and Character Handling & Dynamic Memory Management & Structures, Unions, Enumerations, and Bit-fields & Standard Library Usage and File I/O
Assemble a one-page reference card per domain listing the traps you personally hit during weeks 1 through 7.
Re-solve every missed prediction or broken program from earlier weeks from scratch without consulting your earlier notes.
Take two timed mixed-domain practice sets and classify every error by domain and by root cause.
Write and compile a single 200-line program that touches all ten domains, then review it against your reference cards.
Your checkpoint
A ten-card personal trap sheet, a log of re-solved problems with pass or fail, and two timed practice sets with an error analysis table showing domain, root cause, and corrective action.
Milestones
Week 2: Without notes, write a correct malloc/realloc/free sequence that handles failure and shrinking, and explain why each free is reached exactly once; compile it under a sanitizer with no reports.
Week 4: Given a small multi-file program with a macro bug and an undefined-reference error, name the translation phase responsible for each and produce a working build in under 20 minutes.
Week 6: Predict the sizeof and every member offset of a given struct containing mixed types and a bit-field, then verify with a compiled program; at least 80 percent of predictions must be exact.
Week 8: Score at least 75 percent on a timed mixed-domain set of 40 questions with no domain below 60 percent, and show that every week-1-through-7 deliverable still compiles and runs cleanly.