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

Username:   Password: 
 RegisterRegister   
 arrays of a type
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
zhiyuan_wu




PostPosted: Thu Jun 03, 2004 7:17 pm   Post subject: arrays of a type

This is strange how turing cannot recongize an array in a situation like this:

[/code]
proc L (abj : array 1 .. * of int)
end L
type abc :
record
letters :int
end record
var hay : array 1..3 of abc
L (hay.letters)
[code]
Here, turing would give a message: hay cannot be followed by a "."

But in this situation, it is perfectly legal:
[code]
proc L (abj : array 1 .. * of int)
end L
type abc :
record
letters : array 1..3 of int
end record
var hay : abc
L (hay.letters)

Is there a special syntax for it? Or the only way to send in an array like this is to dump the array into another newly made array? Question
[/code]
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Thu Jun 03, 2004 8:09 pm   Post subject: (No subject)

in the first example, hays is declared as an array of type which means you cant access the member variables of the structure as an array. just create a temporary array and dump the stuff you need into that then use it for the parameter
Delos




PostPosted: Fri Jun 04, 2004 11:13 am   Post subject: (No subject)

I.e.

In case 1:
L (hay(#ElementRef).letters)

is what you are missing.
Delta




PostPosted: Fri Jun 04, 2004 1:27 pm   Post subject: (No subject)

ya for sure 1st example your missing the (#) after hay

code:
hay(1).letters


Next your 2nd example shouldn't work either... are you sure it does?

It should be something like this when being called

code:
L(hay.letters(1))



unless somehow it really does work :S or I just missed something :S
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  [ 4 Posts ]
Jump to:   


Style:  
Search: