title: Passing multiple arguments to a thread in C (pthread_create)
body: <p>I am trying to pass 2 unsigned integers to a newly created thread in C (using pthread_create()) but nor an array of 2 integers or a struct seems to work.</p>
  
  <pre><code>// In my socket file
  
  struct dimension {
      unsigned int width;
      unsigned int height;
  };
  
  unsigned int width, height;
  
  void setUpSocket(void* dimension) {
  
      struct dimension* dim = (struct dimension*) dimension;
  
      width = dim-&gt;width;
      height = dim-&gt;height;
  
      printf("\n\nWidth: %d, Height: %d\n\n", width, height);
  
  }
  
  // In main.cpp
  
  // Pass a struct in pthread_create
  struct dimension dim;
  dim.width = w;
  dim.height = h;
  
  pthread_create(&amp;ph, &amp;attr, (void * (*)(void *)) setUpSocket, (void *) &amp;dim);
  </code></pre>
  
  <p>Before calling pthread_create, dim.width and dim.height are correct. In my socket file, only width is set, height is 0, and I do not understand why.</p>
  
  <p>Does anyone know what is wrong please and how to fix it?</p>
  
  <p>Thank you very much.</p>