The format for a structure declaration is:
struct tag { structure members; } variable names;
where tag is a user selected name, structure members are data members accessed by variables declared as this structure type, and variable names are the names of the variable declared as this type of structure.
You must separate multiple variable names with a comma.
Format |
Description |
---|---|
tag variable_name; |
Declares a variable as this type. |
variable_name.data_member =value; |
Assigns a value to a data member. |
Structural declaration:
struct sample {int test;string name;blob date_time;}
Variable declaration:
struct sample sm1, sm2;
Assigning values:
sm1.test = 100;
sm2.test = 500;
Do not assign one structure variable to another. For
example,
sm2 = sm1
is
invalid. However, you may assign individual elements; thus, sm2.test = sm1.test
is
valid.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |