EC_DICT_GET(3)

✨ EC_DICT_GET(3) ✨

okay bestie, welcome to libecoli's programmer's manual, and today's main character is ec_dict_get πŸ’… she's from the Libecoli Programmer's Manual</...> β€” no wait, keep it cute: she lives in the Libecoli programmer's manual, page EC_DICT_GET(3), and she has ONE job and she does it gorgeously.


🌸 NAME 🌸

ec_dict_get β€” bestie, she gets a value from the hash table. that's it. that's the whole gig. and she eats every time πŸ“


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <ecoli/dict.h>

void * ec_dict_get(
    const struct ec_dict   *dict,  /* The hash table. */
    const char             *key    /* The key string. Must not be NULL. */
);

so you're handing her a pointer to the hash table β€” that's the dict, const struct ec_dict *, she's not gonna mess with it, she's just looking πŸ‘€ β€” and then a key string, const char *, and heads up queen, that key must NOT be NULL. like, non-negotiable. she's giving you a void * back, so whatever you stored in there, that's your problem now πŸ’–


⭐ RETURN VALUE ⭐

  • if she finds your element? you get the element back. slay. that's the dream.
  • if something goes wrong? you get NULL, and errno is set. the vibe check failed, unfortunately 😭
  • plot twist though: if it's actually a success but the element itself happens to be NULL, then errno gets set to 0. so like... NULL but make it successful. iykyk. don't get it twisted ✨
  • and if key is NULL? errno is set to EINVAL. we told you, bestie. the key cannot be NULL. that's the rule πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

she does not run this town alone, she has a whole friend group and you should meet all of them fr fr:

go read them. all of them. no skimming πŸ’œ


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

and that's the whole page, periodt πŸ’… this was libecoli, version dated 2026-06-11, and honestly? iconic. go get your values, bestie 🫢🧚

πŸ“¦ where this page comes from