---
name: "Stack"
section: "3"
platform: "macos"
package: "tcl"
version: "152"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/Stack"
---

# Stack(3)

Manipulate an Itcl stack object.

## NAME

Itcl\_InitStack, Itcl\_DeleteStack, Itcl\_PushStack, Itcl\_PopStack, Itcl\_PeekStack, Itcl\_GetStackValue, Itcl\_GetStackSize - Manipulate an Itcl stack object.

## SYNOPSIS

```
#include <itcl.h>

int
Itcl_InitStack(stack)

int
Itcl_DeleteStack(stack)

int
Itcl_PushStack(cdata, stack)

ClientData
Itcl_PopStack(stack)

ClientData
Itcl_PeekStack(stack)

ClientData
Itcl_GetStackValue(stack, pos)

int
Itcl_GetStackSize(stack)
```

## ARGUMENTS

Stack info structure. position in stack order from the top. Arbitrary one-word value to save in the stack.

## DESCRIPTION

**Itcl\_InitStack** initializes a stack structure and **Itcl\_DeleteStack** deletes it. **Itcl\_PushStack** pushes the *cdata* value onto the stack. **Itcl\_PopStack** removes and returns the top most *cdata* value. **Itcl\_PeekStack** returns the top most value, but does not remove it. **Itcl\_GetStackValue** gets a value at some index within the stack.  Index "0" is the first value pushed onto the stack. **Itcl\_GetStackSize** returns the count of entries on the stack.

## KEYWORDS

stack
