---
name: "Blt_TreeDeleteNode"
section: "3"
platform: "linux"
package: "blt-dev"
version: "2.5.3+dfsg-8"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Blt_TreeDeleteNode"
---

# Blt\_TreeDeleteNode(3)

Deletes a node and its descendants.

```

```

## NAME

Blt\_TreeDeleteNode - Deletes a node and its descendants.

## SYNOPSIS

```
#include <bltTree.h>

Blt_TreeNode
Blt_TreeDeleteNode(tree, node)
```

## ARGUMENTS

- Blt\_Tree *tree* (in)

  Tree containing the node.

- Blt\_TreeNode *node* (in)

  Node to be deleted.

  ```

  ```

## DESCRIPTION

This procedure deletes a given node and all it descendants from a tree data object.

The arguments are as follows:

- *tree*

  The tree containing the parent node.

- *node*

  Node to be deleted.  The node and its descendant nodes are deleted. Each node's data values are deleted also.   The reference count of the Tcl\_Obj is decremented.

Since all tree objects must contain at least a root node, the root node itself can't be deleted unless the tree is released and destroyed. Therefore you can clear a tree by deleting its root, but the root node will remain until the tree is destroyed.

## RETURNS

Always returns TCL\_OK.  Errors generated in a notification callbacks are backgrounded (see **Tcl\_TreeCreateNotifyHandler**).

## EXAMPLE

The following example deletes the root node.

```

Blt_TreeNode root;
root = Blt_TreeRootNode(token);
Blt_TreeDeleteNode(token, root);
```

## NOTIFICATIONS

**Blt\_TreeDeleteNode** can trigger tree notify events. You can be notified whenever a node is deleted by using the  **Blt\_TreeCreateNotifyHandler**.  A callback routine is registered that will be automatically invoked whenever a node is deleted via **Blt\_TreeDeleteNode** to the tree.

## KEYWORDS

tree, token
