// set all values in the hash table to null
for(int i = 0; i < HASH_SIZE; i++)
{
hashtable[i] = NULL;
}
I keep getting this error message in response to hashtable[i]:
assignment makes integer from pointer without a cast [-Werror]
Why?
NULL is defined as (void*)0 in stddef.h
#ifndef _LINUX_STDDEF_H
#define _LINUX_STDDEF_H
#undef NULL
#if defined(__cplusplus)
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
If the hashtable is integer array, like
#include <stdio.h>
#define HASH_SIZE 100
int main()
{
int i = 0, hashtable[HASH_SIZE];
for(i = 0; i < HASH_SIZE; i++)
{
hashtable[i] = NULL;
}
return 0;
}
this warning: assignment makes integer from pointer without a cast will be shown.