(Structure Constructors): Give example with labeled fields.
This commit is contained in:
parent
2f8e7ba6d5
commit
c3ac60dacc
8
c.texi
8
c.texi
|
@ -6687,6 +6687,14 @@ expression (@pxref{Statement Exprs}):
|
||||||
@})
|
@})
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
You can also use field labels in the structure constructor to indicate
|
||||||
|
which fields you're specifying values for, instead of using the order
|
||||||
|
of the fields to specify that:
|
||||||
|
|
||||||
|
@example
|
||||||
|
(struct foo) {.a = x + y, .b = {'a', 0}}
|
||||||
|
@end example
|
||||||
|
|
||||||
You can also create a union value this way, but it is not especially
|
You can also create a union value this way, but it is not especially
|
||||||
useful since that is equivalent to doing a cast:
|
useful since that is equivalent to doing a cast:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue