{"id":27425862,"url":"https://github.com/mstanimirovic/cvec","last_synced_at":"2025-10-12T21:44:08.422Z","repository":{"id":226868936,"uuid":"769518022","full_name":"mstanimirovic/cvec","owner":"mstanimirovic","description":"Vectors in c","archived":false,"fork":false,"pushed_at":"2024-03-10T17:48:10.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T12:50:54.044Z","etag":null,"topics":["arrays","c","cmake","console","dynamic-memory-allocation","library","make","vector","vectors"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mstanimirovic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2024-03-09T10:00:08.000Z","updated_at":"2024-03-10T17:37:53.000Z","dependencies_parsed_at":"2024-03-10T09:25:03.158Z","dependency_job_id":"a9d07254-e85f-424e-acb5-78a5d47df8e5","html_url":"https://github.com/mstanimirovic/cvec","commit_stats":null,"previous_names":["m1ad3n/cvec","mstanimirovic/cvec"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mstanimirovic/cvec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstanimirovic%2Fcvec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstanimirovic%2Fcvec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstanimirovic%2Fcvec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstanimirovic%2Fcvec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mstanimirovic","download_url":"https://codeload.github.com/mstanimirovic/cvec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mstanimirovic%2Fcvec/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266058481,"owners_count":23870157,"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":["arrays","c","cmake","console","dynamic-memory-allocation","library","make","vector","vectors"],"created_at":"2025-04-14T12:29:19.458Z","updated_at":"2025-10-12T21:44:03.361Z","avatar_url":"https://github.com/mstanimirovic.png","language":"C","readme":"# CVec: Vector Library in C\n\nCVec is a simple C library for working with dynamic arrays, providing functionality similar to vectors in other programming languages. It allows you to create, manipulate, and free dynamic arrays efficiently.\n\n## Functions\n\n- `new_cvec`: Create a new CVec with an initial capacity.\n- `cvec_from`: Create a new CVec from an existing array.\n- `cvec_free`: Free memory allocated for a CVec.\n- `cvec_push`: Append an element to the end of the CVec.\n- `cvec_pop`: Remove and return the last element of the CVec.\n- `cvec_resize`: Resize the capacity of the CVec.\n- `cvec_remove`: Remove an element from the CVec at a specified index.\n- `cvec_insert`: Insert an element at a specified index in the CVec.\n- `cvec_clean`: Remove all elements from the CVec.\n- `cvec_front`: Get the first element of the CVec.\n- `cvec_back`: Get the last element of the CVec.\n- `cvec_at`: Get the element at a specified index in the CVec.\n- `cvec_iter`: Iterator for traversing the elements of the CVec.\n\n## Installation\n\n- **Create a build directory**: `mkdir build \u0026\u0026 cd build`\n- **Build from source**: `cmake .. \u0026\u0026 make`\n- **Install all the files**: `sudo make install`\n\n## Usage\n\n- **Include the Header File**: Include `cvec.h` in your C source file.\n- **Compile with Your Project**: Compile your project with -lcvec.\n- **Use the Functions**: Start using the CVec functions in your code.\n\n## CMake Usage\n\n- **Link the library**: `target_link_libraries(ExecName PRIVATE cvec)`\n\n## Example\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003ccvec.h\u003e\n\nint main() {\n    // Create a new CVec\n    cvec* vec = new_cvec();\n    // cvec_from(3, 10, 20, 30) - first argument is number of the elements\n\n    // Push elements into the CVec\n    cvec_push(vec, 10);\n    cvec_push(vec, 20);\n    cvec_push(vec, 30);\n\n    // Print elements\n    for (int i = 0; i \u003c vec-\u003esize; i++) {\n        printf(\"%d \", cvec_iter(vec));\n        // or vec-\u003eitems[i]\n    }\n\n    // Free memory\n    cvec_free(vec);\n\n    return 0;\n}\n```\n\n## License\nThis project is licensed under the MIT License","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmstanimirovic%2Fcvec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmstanimirovic%2Fcvec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmstanimirovic%2Fcvec/lists"}