title: passing arguments to _beginthread() -- whats wrong?
body: <p>I have this code and I am not getting the expected results... whats wrong?</p>
  
  <pre><code>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*) &amp;arg);
  }
  
  void myFunc(void *param) {
     t *args = (t*) param;
     int x = args-&gt;data1;
     int y = args-&gt;data2;
     printf("x=%d, y=%d\n", x, y);
  } 
  </code></pre>