Afternoon, all. I'd like to make an array of structures. Does anyone know how to do this? Any help is appreciated. Cheers, Scronty
Posted on 2001-06-12 22:27:00 by Scronty
Hi do it like this

My_Structure STRUC
  x dd ?
  y dd ?
  z dd ?
  t dd ?
ENDS

;then later in code define a table of 100 elements

My_table My_Structure 100 dup <>

Ok?
Posted on 2001-06-12 23:21:00 by BogdanOntanu

 Bogdan, ehehe, is that TASM or what? MASM throw me two complain
 for using what you just posted.

 i've never actually declare any arrays of structure and would -
 like to know it.

 i've tried:

 TS struct 
   age  db ?
   year db ?
 TS ends
  
 yourTS db 100 dup(TS) <--- i'm not sure if this is the right
 way of making arrays of structure...

 but how do you access it???


Posted on 2001-06-12 23:34:00 by disease_2000
Yes its TASM but it should be easy to convert to MASM ;) show me the complains of MASM and i will fix it ;) (dont have MASM at hand now) but i will tomorow ;) on a first look try this: My_Structure STRUC x dd 0 y dd 0 z dd 0 t dd 0 My_Structure ENDS ; this name in front of ENDS can be req in MASM ;then later in code define a table of 100 elements My_table My_Structure 100 dup ; take care at initializing the structure array ; there are some differences ; but NO "db" must be "My_Structure" ; u can name your table "XX_table" but the type that folows MUST ; match the STRUCT definition check Iczelions examples for corect MASM syntax Accessing the table is another thing ;) mov esi offset My_table mov eax, ; get the x value from row 0 add esi,SIZE My_Structure ; go to row 1 mov ebx, ; get the y on the 2nd row but there are many variations and many tricks also ;)
Posted on 2001-06-13 00:22:00 by BogdanOntanu
This should work in Masm32: MYDATA STRUCT person db 30 DUP (0) address db 30 DUP (0) MYDATA ENDS .data md1 MYDATA 2 DUP ({,},{,}) hth vesa
Posted on 2001-06-13 01:13:00 by vesa