Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Types?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cavetroll




PostPosted: 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
end record


Is it possible to do this? If so what code do I need to add?
Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: Fri Oct 05, 2007 4:29 pm   Post subject: RE:Types?

Are you trying to make a linked list?
Cervantes




PostPosted: 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




PostPosted: 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
   end record


But I no longer have Turing so I'm not sure. Smile
Saad




PostPosted: 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




PostPosted: 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

Again thanks for the help
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: