#include <stdio.h> #include <stdlib.h> #include <string.h>  #define HASHTAB_MUL 31 #define HASHTAB_SIZE 71   struct listnode {     float key;     int value;     struct listnode *next; };      struct listnode *hashtab[HASHTAB_SIZE];  unsigned int hashtab_hash(float key) {     unsigned int h = 0;          h = ((int)key + (int)((key-(int)key)*10)) % HASHTAB_MUL ;      return h % HASHTAB_SIZE; }  void hashtab_init(struct listnode **hashtab) {     int i;      for (i = 0; i < HASHTAB_SIZE; i++) { 	hashtab[i] = NULL;     } }  void hashtab_add(struct listnode **hashtab, float key, int value) {     struct listnode *node;     unsigned int index = hashtab_hash(key);      node = malloc(sizeof(*node));      if (node != NULL) { 	node->key = key; 	node->value = value; 	node->next = hashtab[index]; 	hashtab[index] = node;     } }  struct listnode *hashtab_lookup(struct listnode **hashtab, float key) {     unsigned int index;     struct listnode *node;      index = hashtab_hash(key);          for (node = hashtab[index]; node != NULL; node = node->next) { 	if (node->key == key) { 	    return node; 	}     }     return NULL; }  void hashtab_delete(struct listnode **hashtab, float key) {     unsigned int index;     struct listnode *p, *prev = NULL;          index = hashtab_hash(key);      for (p = hashtab[index]; p != NULL; p = p->next) { 	if (p->key == key){ 	    if (prev == NULL) { 		hashtab[index] = p->next; 	    } 	    else 		prev->next = p->next; 	    free(p); 	    return; 	} 	prev = p;     } }  void hashtab_printf(struct listnode **hashtab) {     int i;     struct listnode *node;          for (i = 0; i < HASHTAB_SIZE; i++) { 	for (node = hashtab[i]; node != NULL; node = node->next) { 	        printf("Index: %d ,Node: %f, %d\n", i,  node->key, node->value); 	}     } }  int main() {     struct listnode *node;          hashtab_init(hashtab);      hashtab_add(hashtab, 1.1, 190);     hashtab_add(hashtab, 0.1223, 2300);     hashtab_add(hashtab, 226.23344, 60);     hashtab_add(hashtab, 32.652345, 190);     hashtab_add(hashtab, 54.234, 1900);     hashtab_add(hashtab, 47000.2355, 200);     hashtab_add(hashtab, 3.00001, 2000);     hashtab_add(hashtab, 655.0343, 1200);     hashtab_add(hashtab, 6.234, 50);     hashtab_add(hashtab, 8.2345, 30);      node = hashtab_lookup(hashtab, 1.1);     printf("Node: %f, %d\n", node->key, node->value);          hashtab_delete(hashtab, 0.01223);          node = hashtab_lookup(hashtab, 0.01223);      if (node != NULL) { 	printf("Node: %f, %d\n", node->key, node->value);     }     else { 	printf("Key '0.01223' not found\n");     }          hashtab_printf( hashtab );      return 0; }