Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How are arrays created and changed in size

Status
Not open for further replies.

SSDESIGN

Programmer
May 11, 2003
71
US
Created an array using htc_wn:={} followed by AFILL(htc_wn,"NOT IN USE"). This results in a single cell having the value of "NOT IN USE".

Later in the program the statement "htc_wn:={}" is run again. What affect does the second use of the command have on the initial array? (Blanks out array? Leaves the initial value in place? Reduces the array back to one cell?)

Thanks for the support...

Bill...



 
Morning Bill

If you knock up a bit of code like that below it should help explain what is going on.

Code:
htc_win := {"hi","there"}  && creates an array with 2 members
? htc_win[1]  && print first member
? htc_win[2]  && print second member
?
afill(htc_win,"not in use")  && fills both
? htc_win[1]  && print first member
? htc_win[2]  && print second member
? len(htc_win)  && show how many members there are
htc_win := {"bye"}  && wipe out the old array and create a new one
? htc_win[1]  && print first member
?
afill(htc_win,"in use") && fill the array
? htc_win[1]  && print out the new member
? len(htc_win)  && print the new size

If you are going to declare the array in this manner, you probably want to set its size and initial values in the manner I have above.



Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Bill,

Here's a sample that I pulled from one of my programs.

msfile = group of files
aFiles = array

The first line is counting the total elements for the array
The second line creates "aFiles" the array
The third line sorts the files names

Basically puts the file names into an array sorted by alpha

DECLARE aFiles[ADIR(msFile)]
ADIR(msFile, aFiles)
ASORT(aFiles)

Jim C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top