Projects/1BIT/summer-semester/IJC-2/htab_for_each.c
2026-04-14 19:28:46 +02:00

17 lines
No EOL
435 B
C

// htab_for_each.c
// Řešení IJC-DU2, příklad b), 22.4.2024
// Autor: Roman Nečas, FIT
// Přeloženo: gcc 11.4.0
#include "htab.h"
#include "htab_struct.h"
void htab_for_each(const htab_t *t, void (*f)(htab_pair_t *data)) {
for (size_t i = 0; i < t->arr_size; i++) {
struct htab_item *item = t->arr_ptr[i];
while (item != NULL) {
f(&item->pair);
item = item->next;
}
}
}