Module 2: Memory, Pointers & Machine Representation: Mistake Clinic
This clinic turns wrong moves into reusable judgment. Use it after each practice page and again before the quiz or checkpoint.
Module-Specific Mistake Radar
Start with these traps. Replace or extend them with real mistakes from your own work.
| Mistake to look for | Where it shows up | Symptom | Repair evidence |
|---|---|---|---|
| Finishing Bits and Representation Lab with only a final answer | Bits and Representation Lab | The work has no failed case, trace, test, proof gap, or design stress point. | Add the smallest broken example and show the repair that changes the result. |
| Finishing Pointers and Arithmetic Workshop with only a final answer | Pointers and Arithmetic Workshop | The work has no failed case, trace, test, proof gap, or design stress point. | Add the smallest broken example and show the repair that changes the result. |
| Finishing Memory Layout and Errors Clinic with only a final answer | Memory Layout and Errors Clinic | The work has no failed case, trace, test, proof gap, or design stress point. | Add the smallest broken example and show the repair that changes the result. |
| Finishing Code Katas with only a final answer | Code Katas | The work has no failed case, trace, test, proof gap, or design stress point. | Add the smallest broken example and show the repair that changes the result. |
| Treating Binary, Hex, and the Byte as the Unit of Access as vocabulary instead of a tool | Binary, Hex, and the Byte as the Unit of Access | The explanation names the concept but cannot decide between two cases. | Write one example, one non-example, and the rule that separates them. |
| Treating Integer Representations: Unsigned, Two's Complement, Overflow as vocabulary instead of a tool | Integer Representations: Unsigned, Two's Complement, Overflow | The explanation names the concept but cannot decide between two cases. | Write one example, one non-example, and the rule that separates them. |
Practice Mistake Checks
Pull any miss from these checks into your mistake log.
Bits and Representation Lab
Source: practice/01-bits-and-representation-lab.md
For each statement, identify the error:
- "
for (unsigned i = n; i >= 0; i--) ...eventually terminates." - "
int x = INT_MAX + 1;givesINT_MINon every C compiler." - "
float a = 0.1f + 0.1f + 0.1f; a == 0.3fis true because all values are small." - "
0xFF == -1on achar." - "Hex is a different number system from binary."
Pointers and Arithmetic Workshop
Source: practice/02-pointers-and-arithmetic-workshop.md
Identify the error in each line:
char *s = "hello"; s[0] = 'H';int *p; *p = 10;int *f(void) { int x = 5; return &x; }int a[5]; memset(a, 0, 5);int a[5], *p = a; if (p + 10 < p) { ... }
Memory Layout and Errors Clinic
Source: practice/03-memory-layout-and-errors-clinic.md
For each program, predict the sanitizer / tool report before you run it:
char b[8]; strcpy(b, "123456789");int *p = malloc(4 * sizeof *p); free(p); p[0] = 1;int *p = malloc(4 * sizeof *p); free(p); free(p);int *p = malloc(4 * sizeof *p); /* never freed */ return 0;int x; printf("%d\n", x); /* uninitialized read */
Repair Protocol
For each real mistake:
- Reproduce the failure on the smallest example, trace, proof, query, command, or design sketch.
- Name the hidden assumption.
- Repair the artifact.
- Save evidence that changed: failing then passing test, corrected proof step, revised diagram, safer command, benchmark, or review note.
- Add one retrieval card beginning with Check... before... or Do not use... when....
Mistake Log
| Date | Mistake | Symptom | Root cause | Repair evidence | Retrieval card |
|---|---|---|---|---|---|
| Starter | Pick one radar row above | Explain how it would fail in this module | Name the assumption | Add a counterexample or corrected artifact | Write the card before closing the page |
Completion Standard
- At least five real mistakes are logged.
- At least two mistakes include a counterexample or failing test.
- At least one mistake connects to an older semester skill.
- At least one correction changes code, a proof, a diagram, a command transcript, a query, or a design decision.