1
我有以下工會結構:與數組指針的聯合聲明?
typedef union Message
{
struct
{
unsigned short header: 16;
unsigned short header2: 16;
unsigned int timestamp: 32;
unsigned int payload: 32;
} pieces;
unsigned short whole[6];
}Message;
如果我宣佈這樣它的工作原理
Message msg = {.whole={255,255,255,0,255,0}};
我只是想知道有什麼方法解決由exsisting陣列申報工會嗎?像這樣:
unsigned short arr[] = {255,255,255,0,255,0};
Message msg = {.whole=arr};