title: rehashing function in C
body: <p>I'm doing a hash table and have implemented the following hash function </p>
  
  <pre><code>int linesn=8;
  int hash(char *str, int table_size)
  {
  int sum;
  
  // Make sure a valid string passed in
  if (str==NULL) return -1;
  
  // Sum up all the characters in the string
  for( ; *str; str++) sum += *str;
  
  // Return the sum mod the table size
  return sum % table_size;
  }
  
  char *str="Carlos";
  int hashv=hash(str,linesn);
  printf("\nThe hash value is: %d",hashv);
  </code></pre>
  
  <p>As in any hash function collisions exist , how could implement a rehashing function to prevent these collisions , I read on Google but examples are complex for me, anyone could give me an idea please.</p>
  
  <p>Thanks in advance</p>