A
anon.asdf
Hi!
I am not succeeding in (statically) initializing a variable of the
following type:
union myunion {
short arr2[4];
int arr4[2];
};
Code attempt (with compilation errors):
/**********************/
#include <stdio.h>
union myunion {
short arr2[4];
int arr4[2];
};
short arr2_v[4] = \
{1, 2, 3, 4};
union myunion mu_v1 = \
(union myunion) arr2_v;
/** ??? **/
union myunion mu_v2 = \
(union myunion) \
(short [4]) {5, 6, 7, 8};
/** ??? **/
union myunion mu_arr_v3[1] = \
{(union myunion) \
(short [4]) {9, 10, 11, 12}};
/** ??? **/
int main(void)
{
return 0;
}
/**********************/
Can the above code be made to work, without using runtime
initialization??
Thanks -anon.asdf
I am not succeeding in (statically) initializing a variable of the
following type:
union myunion {
short arr2[4];
int arr4[2];
};
Code attempt (with compilation errors):
/**********************/
#include <stdio.h>
union myunion {
short arr2[4];
int arr4[2];
};
short arr2_v[4] = \
{1, 2, 3, 4};
union myunion mu_v1 = \
(union myunion) arr2_v;
/** ??? **/
union myunion mu_v2 = \
(union myunion) \
(short [4]) {5, 6, 7, 8};
/** ??? **/
union myunion mu_arr_v3[1] = \
{(union myunion) \
(short [4]) {9, 10, 11, 12}};
/** ??? **/
int main(void)
{
return 0;
}
/**********************/
Can the above code be made to work, without using runtime
initialization??
Thanks -anon.asdf