[討論] struct的Initial
各位好,
有一個關於struct Initial的問題請教.
假使我現在定義了struct/union如下:
typedef union
{
unsigned short wWord;
struct
{
bByteH;
bByteL;
}byte;
}WordVar;
typedef struct
{
unsigned char a;
unsigned char b;
}_defType;
若要在宣告_defType變數的同時Initial, 已知方法如下
_defType AAA = {12, 34};
假使現在定義struct _defType2如下:
typedef struct
{
unsigned char a;
WordVar abc;
}_defType2;
如此, 有可能在宣告_defType2變數時,針對bByteH, bByteL進行initial嗎?
Ex: _defType2 BBB = {12, ???};
PS: 目前已知可以對wWord進行initial(_defType2 BBB = {12, 0x1234};)
PS: Compiler為非C99系統..
謝謝大家.
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 218.210.106.78
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1460448539.A.7A9.html
→
04/12 16:35, , 1F
04/12 16:35, 1F
→
04/12 16:36, , 2F
04/12 16:36, 2F
→
04/12 16:37, , 3F
04/12 16:37, 3F
→
04/12 16:37, , 4F
04/12 16:37, 4F
→
04/13 15:23, , 5F
04/13 15:23, 5F
※ 編輯: MaxHaru (218.210.106.78), 04/13/2016 15:38:21
→
04/13 15:52, , 6F
04/13 15:52, 6F
→
04/13 15:53, , 7F
04/13 15:53, 7F
→
04/13 15:53, , 8F
04/13 15:53, 8F
→
04/13 15:54, , 9F
04/13 15:54, 9F
→
04/13 21:13, , 10F
04/13 21:13, 10F