Hey so I'm trying to pass a hash table as a parameter in c++, when I call the function that I am trying to run i get an error message that i do not understand.
So this is the function:
string getRandomKey(int tableNumber, int tableSize, HashTable<string>* table, int random){
random *= rand() % tableSize + 1;
string randKey = to_string(tableNumber) + to_string(random);
if((table->find(randKey)) == true){
cout << "Key: " << randKey << " found ";
return randKey;
}
return "";
}
This is by no means the final version I'm just trying to test it. Some context is that I have a couple of hash tables, and a separate integer variable that has the number of elements that i have predetermined. The keys are set to be one of the random numbers.
Anyway so here is where I call the function:
table1->print(getRandomkey(1, sizes[2], table1*, 1));
And I get this error:
error: expected expression
table1->print(getRandomKey(1, sizes[2], table1*, 1));
^
1 error generated.
So, I'm not sure what I need to change or if I messed something up somewhere else. Thanks for any help you guys can give!