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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initializing an Array

Status
Not open for further replies.

gforrest

Programmer
Apr 26, 2000
39
0
0
CA
Hi,

I have an array in a file

c_table: packed Array[0..7] of TCASHIER_TABLE;

Does anyone know how I can initialize this to zeros or nulls?

Thanks.
Glenn.
 
gforrest,

I usually do it the hard way, near the beginning of the routine that declares the array, e.g.

for siCounter := 0 to siNTables do
begin
c_table[ siCounter ] := nil; { or whatever }
end;

If it's a global, I usually initialize it in the unit's Initialization section.

Doing so helps avoid Runtime 202 and other errors.

Hope this helps...

-- f
 
Might be quicker to set the contents of the pointer to zero, using Ats and Hats and copying zero into it.!!
In pseudo its something like move(Pointer of c_table, sizeof(c_table), 0)
Cant remember the syntax, something along the lines of
Its something along those lines anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top