{"id":21027320,"url":"https://github.com/franko/libarray","last_synced_at":"2025-09-01T17:42:48.919Z","repository":{"id":144964290,"uuid":"161084768","full_name":"franko/libarray","owner":"franko","description":"Very simple C library for generic dynamic arrays","archived":false,"fork":false,"pushed_at":"2018-12-28T22:04:17.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-20T14:40:11.058Z","etag":null,"topics":["c","generic-dynamic-arrays"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-09T21:52:25.000Z","updated_at":"2023-08-30T11:56:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"a3904ec4-4d73-40c4-9899-dec16993f59f","html_url":"https://github.com/franko/libarray","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franko%2Flibarray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franko%2Flibarray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franko%2Flibarray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franko%2Flibarray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franko","download_url":"https://codeload.github.com/franko/libarray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243464713,"owners_count":20295290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","generic-dynamic-arrays"],"created_at":"2024-11-19T11:49:28.594Z","updated_at":"2025-03-13T18:45:50.679Z","avatar_url":"https://github.com/franko.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Libarray\n\nVery simple C library for generic dynamic arrays. It works in a similar way to C++ templates but using macros.\nIt works only for plain old data that do not need memory allocation or a destructor.\n\nPlease note that the library is just in early development and many functions are missing.\n\n## Motivation\n\nIn C is a common pattern to use arrays that dinamically grows as needed when more elements are added.\n\nThe library avoid writing always the same code over and over again and it provides a type-safe implementation.\n\nHere an example:\n\n```c\n#include \u003cstdio.h\u003e\n#include \"array.h\"\n\n/* Declare an array of int. Using the inline we don't need to provide an implementation\n   in a separate file. */\ndeclare_array_inline(int);\n\nint main() {\n    /* The type array(int) identifies the array of int. */\n    array(int) myarray = array_init();\n\n    /* All the method will use the sintax: array_\u003cmethod_name\u003e(int)(...). For example array_push(int) is\n       used to append elements into the array. */\n\n   for (int i = 0; i \u003c 100; i++) {\n        array_push(int)(myarray, i * i);\n    }    \n\n   /* Elements can be read by using either the 'element' macro or with the 'array_get(int)' function. */\n\n    for (int i = 0; i \u003c myarray-\u003elength; i++) {\n        printf(\"%i\\n\", element(myarray, i));\n    }\n\n    array_free(int)(myarray);\n    return 0;\n}\n```\n\n## How to use\n\nJust add 'array.h' and 'array.c' into your project, that's all.\n\nLibarray is currently provided with a Meson build file and a few simple tests but these are not needed to use the library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranko%2Flibarray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranko%2Flibarray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranko%2Flibarray/lists"}