O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
getters.c File Reference

Expose the state of dynamic arrays. More...

#include "private.h"
#include "o2s/array.h"

Go to the source code of this file.

Functions

void * array_end (const array_t *self)
 One-past-the-end pointer of the array.
void * array_first (const array_t *self)
 Pointer to the first element of the array.
void * array_last (const array_t *self)
 Pointer of the last element of the array.
void * array_get (const array_t *self, size_t index)
 Pointer of the element at position index of the array.
bool array_is_empty (const array_t *self)
 True if the array contains no element.
size_t array_count (const array_t *self)
 Number of elements stored.

Detailed Description

Expose the state of dynamic arrays.

Author
Hugo FOLCHER
Antoine GAGNIERE

Definition in file getters.c.

Function Documentation

◆ array_end()

void * array_end ( const array_t * self)

One-past-the-end pointer of the array.

Returns
NULL if the underlying storage isn't allocated

Definition at line 25 of file getters.c.

◆ array_first()

void * array_first ( const array_t * self)

Pointer to the first element of the array.

Returns
NULL if the array is empty.

Definition at line 36 of file getters.c.

◆ array_get()

void * array_get ( const array_t * self,
size_t index )

Pointer of the element at position index of the array.

Returns
NULL if invalid index.

Definition at line 56 of file getters.c.

◆ array_last()

void * array_last ( const array_t * self)

Pointer of the last element of the array.

Returns
NULL if the array is empty.

Definition at line 45 of file getters.c.