Commit af84b82
committed
Add UB warning before int_ptr.cpp example in Ch 30 / 00.pointers.ipynb
The original example dereferences `*(p + 1)` and `*(p + 2)` past a
single `int i`, which is undefined behavior. The output values shown
in the notebook happen to read adjacent stack memory on most systems,
which is what makes the demonstration useful — but students need to
know this is incidental, not a pattern to rely on.
This commit adds a markdown warning cell immediately before the code
block to make the UB explicit. The deeper refactor (switch to an
actual `int arr[3]` so the dereferences become valid) remains open
under #75 as an Option-1 improvement, since it would also require
updating the dependent cells (sample output, memory map).
Refs #751 parent 58d1a82 commit af84b82
1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
181 | 194 | | |
182 | 195 | | |
183 | 196 | | |
| |||
1154 | 1167 | | |
1155 | 1168 | | |
1156 | 1169 | | |
1157 | | - | |
| 1170 | + | |
0 commit comments