title: Hashing collision keys to next in the hashtable
body: <p>I have a problem in linking the collided keys, the latest key will override the previous key that was linked to the table. I have hard coded for a collision to see if the keys that collide are saved in the linked list correctly, but its not saved correctly. 
  Here is the involved part of the code. </p>
  
  <pre><code>typedef struct student 
  {
      char name[10];
      char sex[4];
      char number[12];
      char mail[50];
      bool filled;
      struct student *next;
  }ST;
  
  void Readfromfile(ST *hashTable)//Read data from txt file and build hash table
  {
      FILE *ft;
      ft = fopen("info.txt", "r");
      if(!ft)
      {
          printf("FAILED TO OPEN FILE\n");
          return;
      }
      char *buffer = malloc(sizeof(char)*43);
      char cp_name[10], cp_sex[4], cp_num[12], cp_mail[50];
      int st_index =0, i;
      while((fgets(buffer, sizeof(buffer)*50, ft)) != NULL)
      {
          if(strlen(buffer) != 0)
              sscanf(buffer, "%s %s %s %s", cp_name, cp_sex, cp_num, cp_mail);
          printf("READ: %s", buffer);
          int hash_value = Hashfun(cp_num);
          ST *current = malloc(sizeof(ST));
          strcpy(current-&gt;name, cp_name);
          strcpy(current-&gt;sex, cp_sex);
          strcpy(current-&gt;number, cp_num);
          strcpy(current-&gt;mail, cp_mail);
          current-&gt;filled = true;
          current-&gt;next = NULL;
          ST *tempHash = &amp;hashTable[hash_value];
          if(tempHash-&gt;filled == true)
          {
              printf("THERE IS A COLLISION at %d SAVING AT NEXT \n\n\n",hash_value);
              while(tempHash!= NULL)
              {
                  printf("I AM PROBLEM HEREEEEEEEEEEEEEEEEEEEEEEE\n");
                  printf("PASSING BY: %s %s %s %s at %d\n",tempHash-&gt;name,tempHash-&gt;sex,
                         tempHash-&gt;number,tempHash-&gt;mail, hash_value);
                  tempHash = tempHash-&gt;next;
              }
              tempHash = current;
              printf("HASHED NEXT: %s %s %s %s at %d\n",tempHash-&gt;name,tempHash-&gt;sex, tempHash-&gt;number,
                     tempHash-&gt;mail, hash_value);
          }
          else
          {
              strcpy(tempHash-&gt;name, cp_name);
              strcpy(tempHash-&gt;sex, cp_sex);
              strcpy(tempHash-&gt;mail, cp_mail);
              strcpy(tempHash-&gt;number, cp_num);
              tempHash-&gt;filled = true;
              tempHash-&gt;next = NULL;
              printf("HASHED: %s %s %s %s at %d\n",tempHash-&gt;name,tempHash-&gt;sex,        tempHash-&gt;number,
                     tempHash-&gt;mail, hash_value);
          }
      }
  }
  </code></pre>