char 配列を構造体に設定しようとしていますが、それを印刷しようとしたときに。セグメンテーション違反が発生します。私は何を間違っていますか?
typedef struct buckets_{
char *key;
data *next;
}buckets;
typedef struct hash_table_ {
int (*hash_func)(char *);
int (*comp_func)(void*, void*);
buckets **buckets_array;
} hash_table, *Phash_table;
table_p -> buckets_array[0] = malloc(sizeof(buckets));
table_p -> buckets_array[1] = malloc(sizeof(buckets));
char word2[5] = "Hieo";
table_p -> buckets_array[1] -> key = malloc(sizeof(word2));
table_p -> buckets_array[1] -> key = word2;
printf("%s",table_p -> buckets_array[i] -> key); /*Getting segmitation falut here*/
Opp は、配列を割り当てる関数があったことを忘れていました。配列が割り当てられたとします。