Привет Я triyng добавить на структуру под названием hash_entry в массив hash_entry внутри другого структуры (hash_table), но я получаю эту ошибку:Ошибка на добавления элемента структуры в массив той же структуры
hash.c:67:5: error: invalid use of undefined type ‘struct hash_entry’
my_table->table[0] = e;
^
hash.c:67:30: error: dereferencing pointer to incomplete type
my_table->table[0] = e;
Мои: Структуры
typedef struct hash_entry{
int value;
} Hash_entry;
typedef struct hash_table{
struct hash_entry * table;
} Hash_table;
Мой код Alloc памяти для массива и добавить:
Hash_entry e;
e.value = 10;
Hash_table *my_table = (Hash_table *) malloc(sizeof (Hash_table));
my_table->table = malloc (sizeof (Hash_entry) * 10);
my_table->table[0] = e;
Почему ваш тип и переменная имеет то же имя? Что вы достигнете? –