From da8cce775090fbd4f2f9113df72c15d6e80e8be0 Mon Sep 17 00:00:00 2001 From: starnakin Date: Thu, 29 Jun 2023 11:40:43 +0200 Subject: [PATCH] add: tablen --- bozolib.h | 1 + src/tab/tab.h | 5 +++++ src/tab/tablen.c | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 src/tab/tab.h create mode 100644 src/tab/tablen.c diff --git a/bozolib.h b/bozolib.h index d53029f..46c2e6e 100644 --- a/bozolib.h +++ b/bozolib.h @@ -2,3 +2,4 @@ #include "./src/lst/lst.h" #include "./src/str/str.h" +#include "./src/tab/tab.h" diff --git a/src/tab/tab.h b/src/tab/tab.h new file mode 100644 index 0000000..88de5d7 --- /dev/null +++ b/src/tab/tab.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +size_t tablen(const void** tab); diff --git a/src/tab/tablen.c b/src/tab/tablen.c new file mode 100644 index 0000000..5ceba85 --- /dev/null +++ b/src/tab/tablen.c @@ -0,0 +1,8 @@ +#include "tab.h" + +size_t tablen(const void **tab) +{ + size_t i; + for (i = 0; tab[i] != NULL; i++); + return i; +}