critbit0_contains(3)
π critbit0_contains(3) π
okay bestie, so this one lives in the Library Functions Manual and it's genuinely the easiest little function in the whole critbit family, no cap π¦
β¨ NAME β¨
critbit0_contains β check whether a string is in the critbit tree ππ³
πΈ SYNTAX πΈ
like, copy this exactly, don't freestyle it:
#include <libowfat/critbit.h>
critbit0_tree cb = { 0 };
int critbit0_contains(critbit0_tree* cb,const char* str);
see that = { 0 }? that's you initialising your tree to empty before you do literally anything else. main character setup energy π
π DESCRIPTION π
so critbit0_contains goes and looks up the string you hand it inside the critbit0 tree. that's it. that's the whole job.
if str is in cb, critbit0_contains returns 1 π otherwise it returns 0 π
it's giving "yes or no, no in between" and honestly? iconic.
β RETURN VALUE β
1β the key was found π slay0β it wasn't π
π«Ά SEE ALSO π«Ά
critbit0_insert(3)β go put stuff in the tree first, bestie, you can't find what you never added π
and that's the whole page!! π this little gem comes from the Library Functions Manual, filed under critbit0_contains(3), and it's still the same critbit0_contains(3) down at the bottom too β consistent queen, we love to see it β¨πΈπ¦
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms