0

I'm trying to create a function for a hash table, but when I run my code I get a warning saying assignment makes integer from pointer without a cast. My code is:

//from header file
//word_t is char*
typedef word_t* vc_ht_key;
typedef void *ht_key;

//in file
size_t hash(ht_key k) {
  unsigned long val = 5381;
  int c;
  while ((c = (*(vc_ht_key)k)++)) {
    val = ((val << 5) + val) + c;
  }
  return (size_t)val;
}

Sorry in advance for any missing information. I was given a generic hash table to work with making it impossible to post all of it here. I was hoping someone could explaining the type casting issue. e.g simply adding an (int) to the while line.

Kayanda
  • 9
  • 3

0 Answers0