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

Username:   Password: 
 RegisterRegister   
 Error When Passing Array Into Procedure
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Jeffmagma




PostPosted: Fri Dec 25, 2015 9:03 pm   Post subject: Error When Passing Array Into Procedure

What is it you are trying to achieve?
I'm trying to pass an array into a procedure, inside an array


What is the problem you are having?
It's giving me the error: Too few subscripts for <arrayName>, even though I'm only trying to pass the higher level of the array


Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Here is an example program that can be used to replicate the problem

Turing:
var a : array 1 .. 2, 1 .. 2 of int := init (1, 1, 1, 1)
%It doesn't matter if you initialise it or not^
proc hi (b : array 1 .. * of int)
    %do stuff
end hi
hi(a (1))


Please specify what version of Turing you are using
OpenTuring 1.0.1
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri Dec 25, 2015 9:15 pm   Post subject: RE:Error When Passing Array Into Procedure

This is a weird quirk of Turing. You need to declare your 2d array as an array of arrays.

var a : array 1 .. 2 of array 1 .. 2 of int

I think it gets implemented differently if you declare it the way you did.
Jeffmagma




PostPosted: Fri Dec 25, 2015 9:26 pm   Post subject: RE:Error When Passing Array Into Procedure

ok thanks so much! i was planning to save my bits, but you've been too helpful...
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  [ 3 Posts ]
Jump to:   


Style:  
Search: