I tried this.
Code:
table_node hashtable[TABLE_LENGTH];
void create_hash_t( )
{
//hashtable = malloc(TABLE_LENGTH * sizeof(table_node));
for (int i =0; i < TABLE_LENGTH; i++)
{
if ((hashtable[i].next = malloc(sizeof(*node)) == NULL))
{
}
}
}
And her is what I get now
Code:
!arortell@gentoo ~/Development/Projects/C_Projects/Data_Structures/HashTable $ make
clang -ggdb3 -O0 -Qunused-arguments -std=gnu99 -Wall -Werror -c -o hashTable.o hashTable.c
hashTable.c:15:43: error: unexpected type name 'node': expected expression
if ((hashtable[i].next = malloc(sizeof(*node)) == NULL))
^
1 error generated.
<builtin>: recipe for target 'hashTable.o' failed
make: *** [hashTable.o] Error 1
I tried to use sizeof(hashtable.next) like you said instead of the type but I get this.
Code:
!arortell@gentoo ~/Development/Projects/C_Projects/Data_Structures/HashTable $ make
clang -ggdb3 -O0 -Qunused-arguments -std=gnu99 -Wall -Werror -c -o hashTable.o hashTable.c
hashTable.c:15:52: error: member reference base type 'table_node [26]' is not a structure or union
if ((hashtable[i].next = malloc(sizeof(*hashtable.next)) == NULL))
~~~~~~~~~^~~~~
1 error generated.
<builtin>: recipe for target 'hashTable.o' failed
make: *** [hashTable.o] Error 1