{"id":17002065,"url":"https://github.com/sagiegurari/c_vector","last_synced_at":"2025-10-08T23:21:43.942Z","repository":{"id":139264101,"uuid":"310805899","full_name":"sagiegurari/c_vector","owner":"sagiegurari","description":"A simple growable vector for C","archived":false,"fork":false,"pushed_at":"2023-09-27T07:12:35.000Z","size":42,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T18:56:45.634Z","etag":null,"topics":["c","c-lib","c-library","data-structures","vector"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sagiegurari.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2020-11-07T09:04:58.000Z","updated_at":"2022-06-14T15:43:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"8d33d7be-361b-4189-b11e-99d62dba2798","html_url":"https://github.com/sagiegurari/c_vector","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sagiegurari/c_vector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_vector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_vector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_vector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_vector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagiegurari","download_url":"https://codeload.github.com/sagiegurari/c_vector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagiegurari%2Fc_vector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000734,"owners_count":26082862,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","c-lib","c-library","data-structures","vector"],"created_at":"2024-10-14T04:26:59.796Z","updated_at":"2025-10-08T23:21:43.919Z","avatar_url":"https://github.com/sagiegurari.png","language":"C","readme":"# vector\n\n[![CI](https://github.com/sagiegurari/c_vector/workflows/CI/badge.svg?branch=master)](https://github.com/sagiegurari/c_vector/actions)\n[![Release](https://img.shields.io/github/v/release/sagiegurari/c_vector)](https://github.com/sagiegurari/c_vector/releases)\n[![license](https://img.shields.io/github/license/sagiegurari/c_vector)](https://github.com/sagiegurari/c_vector/blob/master/LICENSE)\n\n\u003e A simple growable vector for C.\n\n* [Overview](#overview)\n* [Usage](#usage)\n* [Contributing](.github/CONTRIBUTING.md)\n* [Release History](CHANGELOG.md)\n* [License](#license)\n\n\u003ca name=\"overview\"\u003e\u003c/a\u003e\n## Overview\nThis library provides a simple growable vector with many different manipulation functions.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n## Usage\n\n\u003c!-- example source start --\u003e\n```c\n#include \"vector.h\"\n#include \u003cstdio.h\u003e\n\n\nint main()\n{\n  // create new vector which can auto grow as needed.\n  // Can also specify initial size and if allowed to resize using\n  // the following: vector_new_with_options(size, allow_resize)\n  struct Vector *vector = vector_new();\n\n  // populate vector using multiple available functions\n  vector_push(vector, \"test push\");\n  vector_insert(vector, 1, \"test insert\");                          // shifts all items from index 1 forward\n  vector_prepend(vector, \"test prepend\");\n  char *previous_value = (char *)vector_set(vector, 1, \"test set\"); // replaces the item at index 1\n  printf(\"Replaced value at index 1, old value: %s\\n\", previous_value);\n\n  // can fetch any item\n  char *value = (char *)vector_get(vector, 1);\n  printf(\"Value at index 1: %s\\n\", value);\n  value = (char *)vector_pop(vector);\n  printf(\"Last Value: %s\\n\", value);\n\n  // or fetch all items\n  void **all_items = vector_to_array(vector);\n  printf(\"First item: %s\\n\", (char *)all_items[0]);\n\n  // can remove any item\n  value = (char *)vector_remove(vector, 0); // shifts all items after index backward\n  printf(\"Removed first item: %s\\n\", value);\n\n  // modify the vector size\n  size_t size     = vector_size(vector);\n  size_t capacity = vector_capacity(vector);\n  printf(\"Current size: %zu capacity: %zu\\n\", size, capacity);\n  vector_shrink(vector);\n  size     = vector_size(vector);\n  capacity = vector_capacity(vector);\n  printf(\"Current size: %zu capacity: %zu\\n\", size, capacity);\n  vector_shrink(vector);\n  size     = vector_ensure_capacity(vector, 100);\n  capacity = vector_capacity(vector);\n  printf(\"Current size: %zu capacity: %zu\\n\", size, capacity);\n\n  // when we are done with the vector, we release it\n  vector_release(vector);\n} /* main */\n```\n\u003c!-- example source end --\u003e\n\n## Contributing\nSee [contributing guide](.github/CONTRIBUTING.md)\n\n\u003ca name=\"history\"\u003e\u003c/a\u003e\n## Release History\n\nSee [Changelog](CHANGELOG.md)\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\nDeveloped by Sagie Gur-Ari and licensed under the Apache 2 open source license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagiegurari%2Fc_vector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagiegurari%2Fc_vector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagiegurari%2Fc_vector/lists"}