Giter Site home page Giter Site logo

au-array-fall-2018's Introduction

au-array

au-array is a simple array class in C.

Types

typedef struct _au_array
{
    size_t length;       /* number of elements in the array    */
    size_t element_size; /* size of every element in the array */
    void *elements;      /* elements of the array              */
} au_array;
  • typedef void (*au_array_element_handler)(void *element) - a function pointer type for element processing functions

Methods

Creating Arrays

  • au_array* au_array_create() - creates an empty array

  • au_array* au_array_create_of_length(size_t count, size_t size) - creates an array with count elements of size

  • au_array* au_array_create_with_array(au_array *array) - creates a copy from another array

  • au_array* au_array_create_with_buffer(void *buffer, size_t count, size_t size): creates an array from a buffer with count elements of size

Deallocating Arrays

  • void au_array_free(au_array *array) - deallocates the array

  • void au_array_free_with_elements(au_array *array) - deallocates every item in the array with the array itself

  • void au_array_free_with_element_handler(au_array *array, au_array_element_handler handler): calls a deallocation handler for every item in the array before deleting the array itself

Querying Metadata

  • bool au_array_is_empty(au_array *array) - checks if the array is empty

  • size_t au_array_length(au_array *array) - gets the length of the array

  • size_t au_array_size(au_array *array) - gets the size of the array

  • size_t au_array_element_size(au_array *array) - gets the element size of the array

Querying an Array

  • void *au_array_first(au_array *array) - gets the first element of the array or return NULL if empty

  • void *au_array_last(au_array *array) - gets the last element of the array or return NULL if empty

  • void *au_array_get(au_array *array, size_t index) - gets an element at index from the array or return NULL if the index is out of range

Contributors

  • Dmitrii Toksaitov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.