flat assembler
Message board for the users of flat assembler.

Index > Main > A field of a structure of type of other structure

Author
Thread Post new topic Reply to topic
jorido



Joined: 23 Jan 2017
Posts: 53
jorido 04 Feb 2017, 18:58
How can I define or declare a structure in which some members are of type of a pointer other structure? Something like:

Code:
; these are defined
;MyStruct2
;MyStruct3



struc MyStruct {
    .a db ?
    .b dw ?
    .c MyStruct2 ;??? pointer to MyStruct2
    .d MyStruct3 ;??? pointer to MyStruct3
}

    


1. Should ib be "dd ?" ?
2. What if it were not a pointer, but just a struct itself -- value in C?
Post 04 Feb 2017, 18:58
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20571
Location: In your JS exploiting you and your system
revolution 05 Feb 2017, 03:50
For struc you can just use .c dd ? to point to somewhere.

If you want to embed the structure then just do what you have above .c SomeStruc <optional parameters>

BTW: This is one of the areas where struct and struc differ.
Post 05 Feb 2017, 03:50
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.