ch2-Struct
2019-10-24
What is the need to typedef a structure ?
Only one variable was created in the example above, but if there’s a need to create multiple structure variables with the same constituents, it’ll be better to create a user defined data type of the structure by typedef
. Then st_fruit will become a data-type which can then be used to create variables of that type.
1 |
|
Simulation LogClick to try this example in a simulator!
Packed Structures
A packed structure is a mechanism for subdividing a vector into fields that can be accessed as members and are packed together in memory without gaps. The first member in the structure is the most significant and subsequent members follow in decreasing order of significance.
A structure is declared packed using the packed
keyword which by default is unsigned.
看下面注释
Example
1 |
|
Simulation Log
1 |
|
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!