---
name: "ck_array_init"
section: "3"
platform: "linux"
package: "libck-dev"
version: "0.7.2-6"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ck_array_init"
---

# ck\_array\_init(3)

initialize a pointer array

## NAME

**ck\_array\_init** – initialize a pointer array

## LIBRARY

Concurrency Kit (libck, -lck)

## SYNOPSIS

**#include \<ck\_array.h\>**

*bool*\

**ck\_array\_init**(*ck\_array\_t \*array*, *unsigned int mode*, *struct ck\_malloc \*allocator*, *unsigned int initial\_length*);

## DESCRIPTION

The **ck\_array\_init**(*3*) function initializes the array pointed to by the argument *array*. The mode value must be CK\_ARRAY\_MODE\_SPMC. The *allocator* argument must point to a ck\_malloc data structure with valid non-NULL function pointers initialized for malloc, free and realloc. The *initial\_length* specifies the initial length of the array. The value of *initial\_length* must be greater than or equal to 2. An array allows for one concurrent put or remove operations in the presence of any number of concurrent CK\_ARRAY\_FOREACH operations.

## RETURN VALUES

This function returns true if the array was successfully created. It returns false if the creation failed. Failure may occur due to internal memory allocation failures or invalid arguments.

## SEE ALSO

[ck\_array\_commit(3)](/ck_array_commit/3.md), [ck\_array\_put(3)](/ck_array_put/3.md), [ck\_array\_put\_unique(3)](/ck_array_put_unique/3.md), [ck\_array\_remove(3)](/ck_array_remove/3.md), [ck\_array\_deinit(3)](/ck_array_deinit/3.md) [ck\_array\_length(3)](/ck_array_length/3.md), [ck\_array\_buffer(3)](/ck_array_buffer/3.md), [ck\_array\_initialized(3)](/ck_array_initialized/3.md), [CK\_ARRAY\_FOREACH(3)](/CK_ARRAY_FOREACH/3.md)

Additional information available at http://concurrencykit.org/
