// 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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If
hashtableis an array of integers thenhashtable[i]expects an integer andNULLis a pointer.So you’re trying to assign a pointer value to an integer variable(without a cast), this is usually just a warning but since you have
-Werrorall warnings turn into errors.Just use
0instead ofNULL.