FunctionType visit and binary search trees

This is a discussion on FunctionType visit and binary search trees within the C++ Programming forums, part of the General Programming Boards category; In my textbook dealing with binary search trees, in the BST.h header file, they include a function thing as follows: ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    1

    FunctionType visit and binary search trees

    In my textbook dealing with binary search trees, in the BST.h header file, they include a function thing as follows:

    typedef void (*FunctionType)(TreeItemType& anItem);

    They really don't give much of an explination as to what this does and I don't understand how you can write this syntactically or why it works. Also, each of the traverse functions such as

    inorderTraverse(TreeNode *treePtr, FunctionType visit)

    They use FunctionType visit as a paramater.

    Also, there is another function that can be defined in the driver:

    void display(TreeItemType& anItem); which is also used in some functions as a parameter of type FunctionType.

    Can someone explain to me what is going on here because I just don't understand it. Thanks

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,691

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary trees search problem...
    By Umoniel in forum C Programming
    Replies: 2
    Last Post: 02-22-2004, 02:29 PM
  2. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21