summaryrefslogtreecommitdiff
path: root/structures/task8.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'structures/task8.cpp')
-rw-r--r--structures/task8.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/structures/task8.cpp b/structures/task8.cpp
index 15832d2..c0542a8 100644
--- a/structures/task8.cpp
+++ b/structures/task8.cpp
@@ -3,7 +3,7 @@
using namespace std;
-stack *result(stack *&h)
+void solve(stack *&h)
{
stack *res = NULL;
@@ -30,7 +30,7 @@ stack *result(stack *&h)
}
reverse(res);
- return res;
+ h = res;
}
int main()
@@ -46,9 +46,10 @@ int main()
push(head, x);
}
reverse(head);
- stack *res = result(head);
- while (res)
- cout << pop(res) << " ";
+
+ solve(head);
+ while (head)
+ cout << pop(head) << " ";
cout << endl;
return 0;