Repositories » libk0
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

Pretty print the hash table.

Changeset ef44a7080fd3

Parent 8a47745c3345

by Rup Palchowdhury

Changes to one file · Browse files at ef44a7080fd3 Showing diff from parent 8a47745c3345 Diff from another changeset...

Change 1 of 1 Show Entire File khash.c Stacked
 
75
76
77
 
 
 
 
 
 
 
 
 
 
 
 
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@@ -75,3 +75,14 @@
  fprintf(stderr, "#elements: %d\n", h->nel);   fprintf(stderr, "chain length (max/avg): %5.1f/%d\n", avglen, maxlen);  } + +void printhash(Hash *h, void (*printdata)(void*)) +{ + for (int i = 0; i < h->n; i++) { + for (Node *np = h->tab[i]; np != NULL; np = np->next) { + printdata(np->data); + fprintf(stderr, " "); + } + fprintf(stderr, "\n"); + } +}