From 35c54292c811a407864ea028f5485a58dd651320 Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:02:30 -0700 Subject: [PATCH] vault backup: 2024-11-19 21:02:30 --- .../software development/ECE1400/Chapter 17 Exercises.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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