a couple of days ago I posted a question about the best way to dynamicaly allocated data for this program I was doing. I ended up using(and learning) linked lists. Thanks you all that helped.
I got the program working. Hoever, in the process of optimizing it and making it object oriented I broke it.
I have this class which holds the data:
void show(); // recursively prints data from each node.
void diskPut(FILE *); // writes data collected to disk
char * getAddress();
void setAddress(char *);
void setNext(NODE *);
char m_address[MAX_PATH]; // address of file found
NODE *m_next; // This is a pointer to "our m_next node" in our linked list
I'm trying to use the getNext() functin to return a pointer so that I could assign it to another pointer in other to clean up things. for the sake of clarity, here's the function that I'm using:
NODE *walker = head; // Set a "walker node" to the front of the list
while(walker != NULL)
NODE *temp = walker; // Create a temp node
walker=walker->getNext(); // Move the walker to the m_next node on the list
delete temp; // Free the memory
head = tail = NULL; // Set everything to NULL
it's giving me the error that the = is not sutable to do this:
walker = walker->getNext()
basically I'm trying to assing walker the address of the next node. I guess the function is not returning a pointer.
This is the definition of getNext();