resize array dynamically

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
rhoulamikhadija
Posts: 1
Joined: January 29th, 2012, 5:22 pm

resize array dynamically

Post by rhoulamikhadija »

Hello,

Can I resize array dynamically or truncate it in some procedure ?
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: resize array dynamically

Post by Gregory Martin »

Unfortunately there is no way to do this at the moment. I say unfortunately because it would be very convenient to have dynamically-sized arrays or some other kind of collection. Perhaps a future version of CSPro will have this.

Your best bet is to just size it at the highest size you can imagine. You may know that CSPro arrays are actually zero-indexed, so writing "array test(5);" actually gives you an array of six numbers from indices 0-5. Some people use the zero-element to indicate how large the array is. Depending on how you do your processing, you could use that technique to keep track of the size of your array.

Also know that when you pass arrays as function parameters, you can use the tblrow, tblcol, and tbllay functions to get the size of the particular array passed to the function.
Post Reply