//prints the non-null hash buckets void print_buckets(cache_t cache){ cache_real_obj *c = cache->cache; int j = 0; printf("PRINTING BUCKETS\n"); for (j; j < c->num_buckets; j++){ linked_list_t curr_LL = c->buckets[j]; node* current_node = curr_LL->head; if (current_node != NULL){ printf("Bucket %i contains ",j); LL_print(curr_LL); } } }
int main(int argc, char **argv) { LL_node *head1, *head2, *tail1, *tail2, *head_res, *tail_res; LL_init(&head1, &tail1, 3.0); LL_push(&tail1, 1.0); LL_push(&tail1, 5.0); LL_init(&head2, &tail2, 5.0); LL_push(&tail2, 9.0); LL_push(&tail2, 2.0); LL_add(&head_res, &tail_res, head1, head2); printf("Number 1:\n"); LL_print(head1); printf("Number 2:\n"); LL_print(head2); printf("Answer:\n"); LL_add(&head_res, &tail_res, head1, head2); LL_print(head_res); };