Posted: Fri Oct 05, 2007 3:55 pm Post subject: Types?
ok I know how to use types fairly well but I am running into one main issue and I'm not sure if its resolvable
heres what I want to do
Turing:
type node : record
x :int
y :int
parent : node
endrecord
Is it possible to do this? If so what code do I need to add?
Sponsor Sponsor
CodeMonkey2000
Posted: Fri Oct 05, 2007 4:29 pm Post subject: RE:Types?
Are you trying to make a linked list?
Cervantes
Posted: Fri Oct 05, 2007 5:34 pm Post subject: RE:Types?
I think for this you have to use another construction, called collections. There are examples in the linked list tutorial.
richcash
Posted: Fri Oct 05, 2007 9:04 pm Post subject: Re: Types?
I think you can still use type you just need a pointer :
Turing:
type node : record
x :int
y :int
parent : ^node
endrecord
But I no longer have Turing so I'm not sure.
Saad
Posted: Fri Oct 05, 2007 9:14 pm Post subject: RE:Types?
Yes that is correct, to declare a node you would have to do
Turing:
var moo : ^node
% Create a new node and assign the memmory to the pointer new moo
At the end
Turing:
% Free the memmory assigned free moo
cavetroll
Posted: Fri Oct 05, 2007 9:29 pm Post subject: RE:Types?
Yes I am trying to create a linked list thanks for all the help, that tutorial helped lots. I would have responded quicker to save some of you the trouble of posting but I was out. Sorry