News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

C Struct questions

Started by rags, November 29, 2007, 06:33:30 PM

Previous topic - Next topic

rags

Im converting some structs written in C to asm, and have a question concerning my understanding of them.

if I have a struct in C:

typedef struct row_list
    {
      int gc;
      int  z;
     }row_list;


I converted it to:
row_list STRUCT
      gc    dword       ?
      z     dword        ?
row_list ends


The struct in question is:
typedef struct col_list
    {
      int  lsize;
      int row_offset;
      struct  row_list *ptr;
     }col_list;


I have converted to:
col_list struct
 
      lsize        dword        ?
      row_offset   dword        ?
      pntr         dword        ?
col_list ends


I have very limited to non-existant knowledge of C.
Am I correct in understanding that this line in the second C struct: struct  row_list *ptr;
is just a pointer called ptr to the struct (first struct) called row_list, and thus can be defined as a dword?

any help would be appreciated. Thanks

Rags
God made Man, but the monkey applied the glue -DEVO

bozo


rags

Thank you very much Kernel!  :U
God made Man, but the monkey applied the glue -DEVO

donkey

whoops --- wrong thread :)

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

MazeGen

rags, you can do more explicit declaration in MASM:


prow_list TYPEDEF PTR row_list

col_list struct
      lsize        dword        ?
      row_offset   dword        ?
      pntr         prow_list    ?
col_list ends