2.1.26.40 tree_get_level


Description

Get TreeNode level

Syntax

int tree_get_level( const TreeNode & trNode, string * pstrPath = NULL )

Parameters

trNode
[input]the tree node to walk
pstrPath
[output]the string pointer to get the tree node path

Return

the level of TreeNode

Examples

EX1

void tree_get_level_ex1()
{
    Tree tr;
    TreeNode tn=tr.AddNode("L1");
    for(int ii=2; ii<4; ii++)
        tn=tn.AddNode("L"+ii);
    int nLevel=tree_get_level(tn);
    out_int("Tree Node level is ", nLevel);
}

Remark

See Also

Header to Include

origin.h

Reference