I have this code and I am not getting the expected results... whats wrong?
typedef struct {
int data1;
int data2;
}t;
void foo(int a, int b) {
Handle handle;
t arg;
arg.data1 = a;
arg.data2 = b;
handle = (HANDLE) _beginthread( myFunc, 0, (void*) &arg);
}
void myFunc(void *param) {
t *args = (t*) param;
int x = args->data1;
int y = args->data2;
printf("x=%d, y=%d\n", x, y);
}