---
name: "zt_pack_integer"
section: "3"
platform: "linux"
package: "libzt-doc"
version: "0.3.1-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/zt_pack_integer"
---

# zt\_pack\_integer(3)

pack an integer into a variant

## NAME

**zt\_pack\_integer** – pack an integer into a variant

## SYNOPSIS

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

*zt\_value*\

**zt\_pack\_integer**(*intmax\_t value*, *const char \*source*);

## DESCRIPTION

**zt\_pack\_integer** packs an integer, as well as the string describing the expression evaluated to obtain it, into a variant-like *zt\_value*. The source argument is retained by the value and is typically a constant string literal produced by the preprocessor.

## IMPLEMENTATION NOTES

**zt\_pack\_integer** is only provided as a static inline function.

## RETURN VALUES

The packed value.

## SEE ALSO

[zt\_pack\_nothing(3)](/zt_pack_nothing/3.md), [zt\_pack\_integer(3)](/zt_pack_integer/3.md), [zt\_pack\_rune(3)](/zt_pack_rune/3.md), [zt\_pack\_integer(3)](/zt_pack_integer/3.md), [zt\_pack\_unsigned(3)](/zt_pack_unsigned/3.md), [zt\_pack\_string(3)](/zt_pack_string/3.md), [zt\_pack\_pointer(3)](/zt_pack_pointer/3.md) [zt\_value(3)](/zt_value/3.md),

## HISTORY

**zt\_pack\_integer** first appeared in libzt 0.1

In libzt 0.3 the type of the first argument changed to **intmax\_t**, to accommodate for wider values. The resulting value structure encodes the new corresponding kind, **ZT\_INTMAX**. Note that **zt\_value** objects created by programs compiled with earlier versions of libzt are still valid and are internally promoted to the wider type.

## AUTHORS

Zygmunt Krynicki ⟨*me@zygoon.pl*⟩
