#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    2
    Rep Power
    0

    Question Problem with recursive type declaration


    I'm new with delphi and I have a problem with a recursive type declaration. Let me give you an example first:

    type TNode = record
    x, y: integer;
    left: TNode;
    end;

    I'm trying to declare a record-type. But because I want to use it in a recursive routine, I try to declare a 'left' variable of the same type.

    Delphi doesn't like this. Does anyone know how I can solve this problem?

    Thx, Bill
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    Code:
    type
        TNodePtr = ^TNode;
        TNode = record
            x, y : integer;
            left : TNodePtr;
        end;
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Posts
    2
    Rep Power
    0
    Thx,

    I already found it in the help file, but thanks anyway. I apreciate all the help you can give me

IMN logo majestic logo threadwatch logo seochat tools logo