#include <stdio.h>
union test {
int test1;
int test2;
int test3;
};
int testC(union test *x, int q, int w, int e) {
(x->test3)=q;
x--;
(x->test2)=w;
x--;
(x->test1)=e;
x--;
return 0;
};
int main() {
union test hi;
testC(&hi,5,6,7);
printf("%i, %i, %i \n", hi.test1, hi.test2, hi.test3);
int x,*y = 0;
x = 1;
x++;
scanf("%i\n", y);
}
The above code is supposed to create an Union and then "initialize" all its components to the inputs, but instead it just initializes itself to the first one. I've tried x++ and moving the values around, but nothing seems to work.