declaring arrays
Author |
Message |
Blade
|
Posted: Thu Apr 03, 2003 7:03 pm Post subject: declaring arrays |
|
|
i was wondering if you could redeclare arrays... such as you declare an array with 3 elements, then you want to make it bigger, could you redeclare it with 5 elements... and if you cant, how can you do it? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Catalyst
|
Posted: Thu Apr 03, 2003 7:34 pm Post subject: (No subject) |
|
|
you would have to declare it as a flexible array
code: |
var names:flexible array 1..1 of string
|
to change the upper parameter...
code: |
new names,5 %% 5 is the new max
|
|
|
|
|
|
|
Blade
|
Posted: Thu Apr 03, 2003 7:35 pm Post subject: (No subject) |
|
|
ah ic... this is gonna be so sweet, thanks a lot catalyst |
|
|
|
|
|
Tony
|
Posted: Thu Apr 03, 2003 8:36 pm Post subject: (No subject) |
|
|
yea.. or you can just declear it to be big to begin with
C++ doesnt allow dynamic arrays (array range must be known at compile time). Thats why they usually give you rangest on contests such as CCC ("test data will have up to 100 numbers" - so dim array as 100).
but thats C++... though turing is compiled in C++, so I dont think your flexible array will increase program performance... I'd like someone to correct/backup on that though |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|