#include <banjo/main.h>
int main(int argc, char* argv[]) {
(void)argc;
(void)argv;
int a = 42;
bj_info(
"Array length: %d\n", len);
bj_info(
"Capacity after shrink: %d", capacity);
int val_0 = 17;
int val_1 = -50;
int val_2 = 101;
bj_info(
"data = [%d, %d, %d]", data[0], data[1], data[2]);
}
General-purpose definitions for Banjo API.
Header file for Array container type.
void * bj_array_data(const bj_array *array)
Retrieves a pointer to the underlying data of the array.
#define bj_array_new_t(T)
Creates a new bj_array with a payload size inferred from the type T.
Definition array.h:30
struct bj_array_t bj_array
Typedef for the bj_array_t struct.
Definition array.h:21
void bj_array_clear(bj_array *array)
Clears all elements in the array.
void bj_array_push(bj_array *array, const void *value)
Appends a value to the end of the array.
size_t bj_array_capacity(const bj_array *array)
Retrieves the current capacity of the array.
size_t bj_array_len(const bj_array *array)
Retrieves the number of elements in the array.
void bj_array_shrink(bj_array *array)
Shrinks the memory allocation to fit the current array length.
void * bj_array_at(const bj_array *array, size_t at)
Retrieves the value stored at the specified index in the array.
void bj_array_pop(bj_array *array)
Removes the last value from the array.
void bj_array_del(bj_array *p_array)
Deletes a bj_array object and releases associated memory.
#define bj_info(...)
Log a message using the BJ_LOG_INFO level.
Definition log.h:103
Logging utility functions.
All memory-related functions, including custom allocators.