Linked List: Static variable and retieving single value?
I seemed to have lost my last post?
I am having trouble sending one value at a time to the driver program. I tried using a static variable to keep track of the current list pointer but it will not compile. Is there an easy way to read the value of a linked list ONE at a time and remember the location to get the next one?
How can I use a get function to accomplish the retrieval of one value?
Error from static variable declared below:
syntax error: miswsing ';' before *
ListNode missing storage-class or type specifiers
T undeclared identifier
LinkedList, use of class template requires template argument list
static data member cannot be initialized via derived class
Code:
template <class T>
class LinkedList {
public:
LinkedList() (head = NULL;)
:
:
private:
struct ListNode {
T value;
struct ListNode *next;
}
ListNode *head;
static ListNode *location;
}; // end class LinkedList
template <class T>
ListNode *LinkedList<T>::location = head; // does not work