You could just initialize the union variable first thing in main() of course:
Code:
typedef union
{
int *a;
int a1;
} MyUn;
MyUn someVar;
int main()
{
someVar.a1 = 1;
return 0;
}
But if you really want a global variable initialized, you could also just swap the members of the union in the declaration:
Code:
typedef union
{
int a1;
int *a;
} MyUn;
MyUn someVar = {1};