RAD Studio |  |

struct
See Also
Collapse All

Category

Type specifiers

Syntax

Copy Code

    struct [<struct type name>] {
    [<type> <variable-name[, variable-name, ...]>] ;
        .
        .
        .
    } [<structure variables>] ;

Description

Use a struct to group variables into a single record.

<struct type name> An optional tag name that refers to the structure type.

<structure variables> The data definitions, also optional.

Though both <struct type name> and <structure variables> are optional, one of the two must appear.

You define elements in the record by naming a <type>, followed by one or more <variable-name> (separated by commas).

Separate different variable types by a semicolon.

Use the . operator, or the -> operator to access elements in a structure.

To declare additional variables of the same type, use the keyword struct followed by the <struct type name>, followed by the variable names. In C++ the keyword struct can be omitted.

Note: The compiler allows the use of anonymous struct embedded within another structure.
See Also

class

public

union

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