man rarray_pop (Fonctions bibliothèques) - Stack like operators for Roy arrays.
NAME
rarray_pop, rarray_push - Stack like operators for Roy arrays.
SYNOPSIS
#include <roy.h>
void * rarray_push (RArray *array);
void * rarray_pop (RArray *array);
void * rarray_peek (RArray *array);
DESCRIPTION
The intention of these functions is to create a stack interface to arrays so that they may be easily used to create a stack. This is especially useful for small entries such as a single pointer or integer where the overhead of linked lists is not needed or desired.
Due to rarray's auto-expanding behaviour, this essentially produces a stack of infinite size, while still providing good speed.
rarray_push(3) is actually a macro that directly calls rarray_append(3), but is named such so as to provide symmetry with the rarray_pop(3) function. rarray_push(3) appends a new entry to array.
rarray_pop(3) returns a pointer to the last entry in the array, and then removes it from the array. If there are no more entries in the array, it returns NULL.
rarray_peek(3) is actually a macro that directly calls rarray_last(3). rarray_peek(3) returns the last entry in array without removing it.
RETURN VALUE
These functions return pointers to entries in the array. These entries must then be cast to the appropriate types as defined when created using rarray_new(3).
ERRORS
These calls produce no errors.
SEE ALSO
rarray(3), rarray_append(3), rarray_free(3), rarray_last(3), rarray_len(3), rarray_new(3), rarray_nth(3), rarray_peek(3), rarray_push(3), rarray_set_len(3), roy(3)