I'm trying to add a persons and number to a hash table, but when I'm adding these values I get the incompatible pointer types passing 'char *[20]' to parameter of type 'char *' error.
I'm also getting an EXC_BAD_ACCESS (code=1, address=0x140) when assigning the customer_number to the index.
typedef struct
{
char *first_name[20];
int customer_number;
} Customer;
Customer *list[10];
int hash_table[10];
void insert(char *first_name, int customer_number)
{
int index = calculate_hash(customer_number);
list[index]->customer_number = customer_number;
strcpy(list[index]->first_name, first_name);
hash_table[index]=customer_number;
}
int main(void)
{
insert("Chris", 9999);
return 0;
}
When the insert is passed a first name and phone_number, I want these to be added to the hash.