diff --git a/education/software development/ECE1400/Chapter 17 Exercises.md b/education/software development/ECE1400/Chapter 17 Exercises.md index 4d0498c..e57b3a3 100644 --- a/education/software development/ECE1400/Chapter 17 Exercises.md +++ b/education/software development/ECE1400/Chapter 17 Exercises.md @@ -38,4 +38,10 @@ for (p = first; p != NULL; p = p->next) free(p); ``` -The above loop won't function because it deallocates an entry, resulting \ No newline at end of file +The above loop won't function because it deallocates the entry, then attempts to access the pointer to the next item, *after* it's already been freed. + +A functional example might look like this: +```c +struct entry* p = first; + +``` \ No newline at end of file