Skip to content

Commit

Permalink
fix explanation for q4
Browse files Browse the repository at this point in the history
  • Loading branch information
Dankco committed Feb 24, 2024
1 parent 6e28ba8 commit 3805cd8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pages/Exercise6.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const question4 = [
'Not quite, if we just take the first two iterations, we delete the head node, then we dereference the head pointer to the head node to get the next pointer and then delete that. This is a problem because we access the deleted head node, which is undefined behavior.',
],
[
'delete head;\n\nfor(Node* ptr = head->next; ptr != nullptr; ptr = ptr->next)\n{\n delete ptr;\n}',
'delete head;\nfor(Node* ptr = head->next; ptr != nullptr; ptr = ptr->next)\n{\n delete ptr;\n}',
'Not quite, since we deleted the head node already, referencing head->next dereferences the head pointer to the head node and is undefined behavior.',
],
[
Expand Down

0 comments on commit 3805cd8

Please sign in to comment.