How do I create records that point to a record of the same
CBFalconer
cbfalconer at yahoo.com
Tue Mar 15 12:54:34 CET 2005
loop lopy wrote:
>
> I have changed from gpc into turbo pascal.
> The code that compiled for me in gpc doesnt compile
> now in turbo pascal.
> The code:
>
> type NumNode = record
> Value: integer;
> pNext: ^ NumNode;
> end;
>
> The compile error I get:
> Undefined type in pointer definition (NUMNODE)
Apart from the fact that TP can't compile Pascal, that shouldn't
compile anywhere. You can't use NumNode until it is defined, and
it isn't defined until the "end;" is encountered. Except to
forward define a pointer type. Thus you need:
TYPE
NumNodePtr = ^NumNode;
NumNode = RECORD
Value : integer;
pNext : NumNodePtr;
END;
Get a Pascal book.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More information about the Gpc
mailing list