Computer Science Canada

resizing first dimension of flexible array

Author:  omni [ Thu Apr 29, 2004 5:08 pm ]
Post subject:  resizing first dimension of flexible array

I want to be able to change the size of the first dimension of a 2d array

var data:flexible array 0..1,0..3 of int
var count:int:=0
loop
count:=count+1
new data,count
exit when count=10
end loop
This is just an example, but it gives me an error about expected comma.

Author:  Delos [ Thu Apr 29, 2004 6:12 pm ]
Post subject: 

You cannot resize the first umm...thing or a multidimensional array.

You would do it like this:

code:

new data, count, count


But that doesn't work.

You could do this:

code:

    new data, count, upper (data, 2)

Author:  Cervantes [ Thu Apr 29, 2004 7:02 pm ]
Post subject: 

same general topic here: anyone know how to do flexible arrays in records? can it be done in this version of turing?

Author:  Raugrist [ Fri Apr 30, 2004 4:46 am ]
Post subject: 

I guess not. "Syntax error at flexible"

Author:  Tony [ Fri Apr 30, 2004 6:07 am ]
Post subject: 

flexable array inside a record type? Confused no... Laughing

Author:  Delos [ Fri Apr 30, 2004 9:25 am ]
Post subject: 

You can't make a record of flexible arrays...but on the other hand you could make a flexible array of records!

code:

type test :
record
array 1..4 of int
end record

var anotherTest : flexible array 1..0 of test


And play with that...but that is apparently obvious.

Author:  Kuntzy [ Fri Apr 30, 2004 7:08 pm ]
Post subject: 

I've tryed multidymentional flexible arrays before, at least with just 4.00 they don't work ... but at least they say their sorry about it. I haven;t tried with the updates though.


: