#include <stdio.h>
#include <stdlib.h>

typedef struct MainStruct {

    struct SubStruct1 {
        int Value;
    } s1;

    struct SubStruct2 {
        int Value;
    } s2;

    struct SubStruct3 {
        int Value;
    } s3;

} MainStruct_t;

typedef union {
    struct SubStruct1 *s1;
    struct SubStruct2 *s2;
    struct SubStruct3 *s3;
    int Value;
} T;

void setValue( T **t, int i )
{
  (*t)->Value=i;
}

int main()
{
    MainStruct_t x;
    printf("%d %d %d\n",x.s1.Value,x.s2.Value,x.s3.Value);

    {
        T t1={&x.s1},t2={.s2=&x.s2},t3={.s3=&x.s3};

        setValue( &t1, 1);
        setValue( &t2, 2);
        setValue( &t3, 3);
    }

    printf("%d %d %d\n",x.s1.Value,x.s2.Value,x.s3.Value);

    return 0;
}
