This is part of my code.
I want to declare an array of List, and I want to be able to pass this array to the functions listed below, so that I can do work on the array (i.e. add/delete nodes). But I have problems getting my head around pointers and references. I hope someone understand what I mean, It's hard to formulate the questions :p
struct Node
{
string word;
Node* next;
};
struct List
{
Node* head;
};
void placeWordsInBuckets(List &linkedList, string *sort, int d) //What should I write here so that this function can do work on the array of List?
void arrangePointers(List &linkedList)
void rearrangeSortList(List &linkedList, string *sort)
void eraseLinkedList(List &linkedList)
int main
{
List* linkedList[26] = { NULL }; // What is the right way to declare an array of List, so that it can be passed on as parameter to other functions?
string sort[] = { "ray", "day", "buy" };
for(int d=2;d>=0;d--)
{
placeWordsInBuckets(linkedList, sort, d); //What is the right way to pass on the array of List to these different functions?
arrangePointers(linkedList);
rearrangeSortList(linkedList, sort);
eraseLinkedList(linkedList);
}
}