Is there a linked list in C++ that I could just #include? Or do I need to create my own if I want to use one?
A linked list is a sequence of data structures, which are connected together via links. Linked List is a sequence of links which contains items. Each link contains a connection to another link.
As daniel notes, yes, std::list . Usage would be: #include <list> // ...
What is Linked List in C? A Linked List is a linear data structure. Every linked list has two parts, the data section and the address section that holds the address of the next element in the list, which is called a node.
As daniel notes, yes, std::list
. Usage would be:
#include <list> // ... std::list<int> listOfInts; listOfInts.push_back(1); // ...
And so on.
You can find a complete list of STL classes here. The section you're after is 3.2, Container classes. Another useful reference of the C++ Standard Library is here.
#include <list>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With