Assembly Language Help (alang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Declare Structure Data Type
◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Syntax: name STRUCT [alignment] [, NONUNIQUE]
fielddeclarations
name ENDS
See also: Structure field operator (.), ENDS, UNION, RECORD, DUP, /Zp,
OPTION OLDSTRUCTS, MASM 5.1 Compatibility
Description:
Declares a structure as a new data type. STRUC is a synonym for
STRUCT and is included for compatibility.
Once a structure name is declared, you can use it to define
variables in which each field not initialized assumes the default
value:
[name] structname <[initializer [, initializer]...]>
or
[name] structname { \
[initializer] \
[, initializer]... \
}
or
[name] structname constant DUP ({[initializer[, initializer]...]})
Curly braces or angle brackets are required even if no initializers
are given. The DUP operator can be used to make duplicate
initializations. Structures may be nested.
You must refer to structure members in the format
structurename.membername or with a pointer to a structure followed
by the .membername tag. You can use multiple sequential membernames
to specify elements of nested structures.
See: ◄Structure field operator (.)►, ◄PTR►
The NONUNIQUE parameter requies elements of the structure to be
accessed only by their fully specified names.
The ORG directive has a special meaning inside a STRUCT block.
See: ◄ORG directive►
Parameter Description
name A unique symbolic name for the structure.
alignment 1, 2, or 4. Byte boundary to align structure
fields. The default is 1.
See: /Zp
fielddeclarations Any valid data definitions (using BYTE, WORD,
etc.) with initial values. Can also be another
previously defined structure or a user-defined
type. Field names do not need to be unique; you
can reuse the same name in multiple structures.
Some other directives are allowed in this field;
see the BNF Appendix in the MASM Programmer's
Guide.
initializer Data initializer for structure field.
-♦-