EC_DICT_ITER(3)

πŸ’– ec_dict_iter(3) β€” Libecoli Programmer's Manual πŸ’–

okay bestie, welcome to the ec_dict_iter page, straight outta the Libecoli Programmer's Manual, and no cap this one is a lil cutie πŸŽ€


✨ NAME ✨

ec_dict_iter β€” iterate the elements in the hash table. yes bestie, it's a walk-the-dict situation πŸ’…


🌸 SYNOPSIS 🌸

#include <ecoli/dict.h>

struct ec_dict_elt_ref * ec_dict_iter(
    const struct ec_dict   *dict   /* The hash table. */
);

so you pull in <ecoli/dict.h>, hand it your hash table, and it hands you back a struct ec_dict_elt_ref *. iconic behavior honestly 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

the typical usage is as below β€” this is the moment, the main character loop, the one you're gonna be typing over and over:

for (iter = ec_dict_iter(dict);
     iter != NULL;
     iter = ec_dict_iter_next(iter)) {
   printf("  %s: %p0,
       ec_dict_iter_get_key(iter),
       ec_dict_iter_get_val(iter));
}

like, you kick it off with ec_dict_iter(dict), keep going while iter != NULL, and each lap you level up with ec_dict_iter_next(iter). then inside the loop you grab the key with ec_dict_iter_get_key(iter) and the value with ec_dict_iter_get_val(iter). it's giving for-loop but make it slay ⭐


πŸ”₯ RETURN VALUE πŸ”₯

an iterator element, or NULL if the dict is empty. yeah so if you get NULL back it's not you, it's the dict β€” there's just nothing in there πŸ™ˆ


πŸ’œ SEE ALSO πŸ’œ

the whole friend group, go say hi:


Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.


ok that's the whole page bestie, you ate it up, no crumbs left πŸ’…βœ¨

and a lil sign-off for the girlies who read to the very end: this one's from libecoli, dated 2026-06-11, and it lives at EC_DICT_ITER(3) in the manual. periodt πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from