2.1.26.28 tree_count_items


Description

Count number of leaves in the given tree

Syntax

int tree_count_items( TreeNode & tr, int * lpnSections = NULL )

Parameters

tr
[Input] TreeNode to count
lpnSections
[Input] if given, then count the number of branches that contain these leaves

Return

total number of leaves

Examples

EX1

void tree_count_items_ex1()
{
    Tree tr;
    tr.Math.Grade.dVal = 90.5;
    tr.English.Grade.dVal = 95.5;
    tr.Math.Bookname.strVal = "Advanced Math";
    tr.English.Bookname.strVal = "English 1";    
    int nCount = tree_count_items(tr.Math); 
    int nSections;
    nCount = tree_count_items(tr, &nSections);
}

Remark

See Also

tree_count_items_by_attribute

Header to Include

origin.h

Reference