From 08c1b44e5779393fb2737d0f87e0001c44f409e8 Mon Sep 17 00:00:00 2001 From: aliriza Date: Thu, 29 Aug 2024 01:54:04 +0300 Subject: [PATCH] add array library example --- example/application/array.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 example/application/array.c diff --git a/example/application/array.c b/example/application/array.c new file mode 100644 index 0000000..f9b967f --- /dev/null +++ b/example/application/array.c @@ -0,0 +1,27 @@ +/* ymp header */ +#include +/* for printf */ +#include +/* +Build command: + gcc `pkg-config --cflags --libs ymp` array.c -o array +*/ + +int main(int argc, char** argv){ + /* define array */ + array *a = array_new(); + /* add items */ + array_add(a,"hello"); + array_add(a,"world"); + array_add(a,"test"); + /* delete item */ + array_remove(a,"test"); + /* get all items */ + int len=0; + char** arr = array_get(a,&len); + /* print items */ + for(int i=0;i