Hi All,
I keep getting these errors when I compile my hash table within a struct:
This is the code of what I have done, hash.h contains all the required functions and when hashStruct is commented out it works fine.error: syntax error before 'List'
warning: no semicolon at end of struct or union
I am able to declare the hash table in the same way without it being in a struct, any ideas whats wrong?Code:#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "hash.h" struct hashStruct { List hashTable[MAXTABLE]; int second variable; } typedef struct hashStruct test; int main() { test myHash; List hashTable[MAXTABLE]; // This works initialiseHash(myHash.hashTable); return 1; }
A brief background, this hash table is part of a much larger program with a large struct that contains alot of useful information. I would prefer to just have the hash table accessible inside this struct then have to pass it around seperately.
Thanks,
Nick