From 8c40c473ab5698ad7e510fe742d46a0e641e6cd8 Mon Sep 17 00:00:00 2001 From: Connor McDowell Date: Sat, 10 Feb 2024 11:16:34 -0800 Subject: there was an incorrectness, newNode and nextNode's swap did not persist after the function ended --- Inclass 10/PointerExamples.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Inclass 10/PointerExamples.cpp') diff --git a/Inclass 10/PointerExamples.cpp b/Inclass 10/PointerExamples.cpp index 3a652e0..4a1bc7a 100644 --- a/Inclass 10/PointerExamples.cpp +++ b/Inclass 10/PointerExamples.cpp @@ -8,9 +8,10 @@ using std::endl; void Swap(Node* first, Node* second) { - int test; + int test, test2; test = first->data; - first->data = second->data; + test2 = second->data; + first->data = test2; second->data = test; cout << test << endl; -- cgit v1.2.3