RAD Studio |  |

Structures
Collapse All

This section contains Structure topics.

Topics

Name | Description
Structures | A structure is a derived type usually representing a user-defined collection of named members (or components). The members can be of any type, either fundamental or derived (with some restrictions to be noted later), in any sequence. In addition, a structure member can be a bit field type not allowed elsewhere. The structure type lets you handle complex data structures almost as easily as single variables. Structure initialization is discussed in Arrays, structures, and unions in the help topic Initialization. In C++, a structure type is treated as a class type with certain differences: default access is public, and... more
Untagged Structures And Typedefs | If you omit the structure tag, you can get an untagged structure. You can use untagged structures to declare the identifiers in the comma-delimited struct-id-list to be of the given structure type (or derived from it), but you cannot declare additional objects of this type elsewhere
Structure Member Declarations | The member-decl-list within the braces declares the types and names of the structure members using the declarator syntax shown in CodeGear C++ declaration syntax. A structure member can be of any type, with two exceptions The member type cannot be the same as the struct type being currently declared:
Structures And Functions | A function can return a structure type or a pointer to a structure type:
Structure Member Access | Structure and union members are accessed using the following two selection operators: . (period) -> (right arrow) Suppose that the object s is of struct type S, and sptr is a pointer to S. Then if m is a member identifier of type M declared in S, the expressions s.m and sptr->m are of type M, and both represent the member object m in S. The expression sptr->m is a convenient synonym for (*sptr).m. The operator . is called the direct member selector and the operator -> is called the indirect (or pointer) member selector. For example:
Structure Name Spaces | Structure tag names share the same name space with union tags and enumeration tags (but enums within a structure are in a different name space in C++). This means that such tags must be uniquely named within the same scope. However, tag names need not differ from identifiers in the other three name spaces: the label name space, the member name space(s), and the single name space (which consists of variables, functions, typedef names, and enumerators). Member names within a given structure or union must be unique, but they can share the names of members in other structures or unions.... more
Incomplete Declarations | Incomplete declarations are also known as forward declarations. A pointer to a structure type A can legally appear in the declaration of another structure B before A has been declared:
Bit Fields | Bit fields are specified numbers of bits that may or may not have an associated identifier. Bit fields offer a way of subdividing structures (structs, unions, classes) into named parts of user-defined sizes. Declaring bit fields You specify the bit-field width and optional identifier as follows:

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!