That is how I solved it as well. My situation was I have about 10- 15 small functions that compared and retrieved information out of an array of structures. In the event that I need to shrink or expand the size I didn't want to change 10-15 functions. So I just used a global array index as you noted and all is good.
Although I will try it can you use a constant to declare an array size?
I thought I have done this in the past but can't find the code. Is there a function to return the upper bound to an array dynamically? For instance
MyArray :Array[0..8] of int;
for i := 0 to MAX(MyArray) do
something
end_for
As long as it returns either the number of elements or the Max index.
Hi Steve,
No there is no way to do that.
I always use constants to declare arrays and by doing that i get the bounds of the array.
regards
Ralph
Thanks,
That is how I solved it as well. My situation was I have about 10- 15 small functions that compared and retrieved information out of an array of structures. In the event that I need to shrink or expand the size I didn't want to change 10-15 functions. So I just used a global array index as you noted and all is good.
Although I will try it can you use a constant to declare an array size?
In other words
Ups sorry, thats exacly what i meant!
Yes you can use constants in declaration to define the array bounds.
regards
Ralph