I'm new at C++ programming and I'm having troubles trying to define a pointer to a list. This is the code I'm trying to use:
list<int>* pl;
The error:
/home/julian/Proyectos Code::Blocks/pruebas/main.cpp|17|error: expected type-specifier before ‘list’|
Is it posible to define a pointer to a list? I need to have a function that returns a pointer to a list.
Thank you very much
You have to include the list
header and qualify the name list
:
#include <list>
std::list<int> *p;
Alternatively:
using std::list;
list<int> *p;
list
resides in std
namespace. So try doing -
std::list<int>* pl;
Try the following:
std::list<int>* pl;
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