I get this message when trying to insert an object to a table
(struct) that holds an array of a struct type ObjectLink
. The structs:
typedef struct ObjectLink {
void *key;
struct Object *next;
} ObjectLink;
typedef struct Object {
void *key;
ObjectLink *top;
} Object;
typedef struct Table{
ObjectLink *linkedObjects;
int size, originalSize;
HashFcn hfun;
PrintFcn pfun;
ComparisonFcn fcomp;
} Table;
The code that is failing (on all assignments & if statement):
Boolean InsertObject(TableP table, ObjectP object)
{
int i = table->hfun(object, table->size);
if (table->linkedObjects[i]->key == NULL)
{
table->linkedObjects[i]->key = object;
} else
{
table->linkedObjects[i]->next->key = object;
}
return TRUE;
}
I've searched in previous questions but that didn't help. What is wrong here?