I have the following union structure:
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;
If I declare this way it works
Message msg = {.whole={255,255,255,0,255,0}};
I am just wondering there is any solution to declare union by an exsisting array? Like this:
unsigned short arr[] = {255,255,255,0,255,0};
Message msg = {.whole=arr};