Does this have any memory issue | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Does this have any memory issue

Refer code below: https://www.sololearn.com/en/compiler-playground/cMRzn4OjzvRN Does this have any memory or other issue? I tried and it works fine , but I was told about code having issue. Could any one please help to identify issue or confirm my understanding of no issue?

13th Apr 2024, 9:54 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 ответов
+ 1
why not just use c++ std::forward_list if you want singly-linked list? std::list would be for doubly-linked list. https://en.cppreference.com/w/cpp/container/forward_list
15th Apr 2024, 4:28 AM
Bob_Li
Bob_Li - avatar
+ 1
I can definitely use it and I always use the same when doing production code This query is on actual implementation of list which we should try to implement as a part of learning.
15th Apr 2024, 5:29 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Ketan Lalcheta Good point. ok. Maybe dive into the stl souce code to find some idea on how they decided to implement it?
15th Apr 2024, 5:32 AM
Bob_Li
Bob_Li - avatar