You only created an array pointers. But those pointers don't point to any valid memory - they are uninitialized. This is undefined behaviour.
The macro null
doesn't make much sense either. If you want to initialize the pointer to NULL pointer then you can simply do:
char *hash_table[hash_size] = {0};
or if you really want each pointer to point to the string literal "null"
then you can assign it:
for(i=0;i<hash_size;i++){
hash_table[i]=null;
}
The assignment works because each of the pointers in the array is simply pointing at the string literal and point to the same string literal too.
If you want to be able to modify the memory that the pointers point to then you need to allocate memory:
for(i=0;i<hash_size;i++){
hash_table[i] = malloc(sizeof("null"));
if (hash_table[i]) {
*/ error */
}
strcpy(hash_table[i],null);
}
And free()
the pointers in a similar loop once you are done.