Passing arrays to functions.

I've been working on programming a database using hash functions. Today I ran into a problem when trying to pass an array to a function and I was hoping someone could help me out! Here's the problem...

The array I am working with is an array of LinkedLists with a template class ID, which is a object I created. Here is what the declaration looks like for the array.

DoublyLinkedList <ID> HashTable[1000];

The problem I am having is when I try to pass that full array to another function, I'm getting errors that deal with parameters.

I want to pass that full array to a Find and a Delete function. The prototypes are below for the two functions.

void Find(string Name, DoublyLinkedList<ID> HashTable);
void Delete(string Name,DoublyLinkedList<ID> HashTable);

Here is the code that I thought would work for passing this array.

Find(Name,HashTable[]); AND Delete(Name,HashTable[]);

The error I am getting is...

error C2664: 'Find' : cannot convert parameter 2 from 'DoublyLinkedList<Type> [1000]' to 'DoublyLinkedList<Type>' g:\programs\cis 226\database using hash table\database using hash table.cpp 108


Any thoughts on how I can pass this array correctly?

Thanks!
Jvb182


1
2
3
4
5
6
// Correct declaration:
void Find( string Name, DoublyLinkedList<ID> HashTable[ 1000 ] );

// Correct invocation:
Find( Name, HashTable );
// (assuming HashTable is of type DoublyLinkedList<ID>[1000]) 

Topic archived. No new replies allowed.