Help with hash table - local function definition illegal
46) : error C2664: 'hash_table_insert' : cannot convert parameter 1 from 'int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Any ideas on what i am doing wrong?
#include <iostream>
using namespace std;
struct chainnode
{
int item;
chainnode *next;
};
void hash_table_insert (int *input, const array_size);
void init_hashtable();
chainnode *hashtable[75];
typedef int boolean;
boolean success;
const int arraysize = 150;
const int partialsize = 50;
int probe;
int InpEnt;
int main()
{
int command;
do
{
cout << endl;
cout << "Select an option and press <enter>:" << endl;
cout << "\t0 = Exit" << endl;
cout << "\t1 = Add a key value to the hash table" << endl;
cout << "\t2 = Return the table index of a value" << endl;
cout << "\t3 = Return the location of the next slot to use" << endl;
cin >> command;
system("cls"); // Screen clear//
switch (command)
{
case 0:
exit(0);
case 1:
{
cout <<"Enter a value between 1 and 100 to insert into the table." << endl;
cin >> InpEnt;
hash_table_insert(InpEnt, arraysize);
}
break;
case 2:
{
cout <<"Enter a value to find the index of." << endl;
}
break;
case 3:
{
cout <<"The value of the next slot to be used is: " << endl;
}
break;
}
}
while (command != 0);
return 0;
}
void hash_table_insert(int *array, int arraysize)
{
chainnode *temp;
int key;
probe = 0;
for (int index = 0; index < arraysize; index++)
{
key = array[index] %75;
temp = new chainnode;
success = boolean(temp != NULL);
if (success)
{
probe++;
temp -> item = array[index];
temp -> next = hashtable[key];
hashtable[key] = temp;
}
else cout << "prog error1 " << endl;
}
cout << "Number of probes to insert " << arraysize << " items: " << probe << endl << endl;
}
void init_hashtable()
{ // Initialize each ptr to NULL
for(int i = 0; i < 75 ; i++)
{
hashtable[i] = NULL;
}
} // end init_hashtable

