---
name: "array_truncate"
section: "3diet"
platform: "linux"
package: "libowfat-dev"
version: "0.28-2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/array_truncate/3diet"
---

# array\_truncate(3diet)

reduce number of initialized bytes

## NAME

array\_truncate - reduce number of initialized bytes

## SYNTAX

**#include \<array.h\>**

void **array\_truncate**(array\* *x*, uint64 *membersize*, int64 *len*);

  array\_truncate(&*x*,sizeof(*t*),*len*);

## DESCRIPTION

array\_truncate reduces the number of initialized bytes in *x* to exactly *len*\*sizeof(*t*). If the number of initialized bytes was already this small (or smaller), array\_truncate has no effect. If *len* is negative, array\_truncate has no effect. If *x* is unallocated, array\_truncate has no effect. If *x* has failed, array\_truncate has no effect.

array\_truncate does not change the allocation in *x*. If you want to free the memory used by *x*, use array\_reset.

## SEE ALSO

[array\_allocate(3)](/array_allocate/3.md), [array\_get(3)](/array_get/3.md), [array\_fail(3)](/array_fail/3.md), [array\_trunc(3)](/array_trunc/3.md), [array\_reset(3)](/array_reset/3.md)
