title: Passing multiple arguments to a thread from a structure
body: <p>I'm having problems passing the arguments, using a structure containing another structure </p>
  
  <p>i know there's something wrong with the way i'm using the structures but i just cant see where...</p>
  
  <p>Thanks!</p>
  
  <p>this is my struct</p>
  
  <pre><code>typedef struct {
  IMAGE *imagenfte;
  IMAGE *imagendst;
  }thread_data;
  
  //thread_data *data = (thread_data *) malloc(sizeof(thread_data));
  </code></pre>
  
  <p>this is the other structure</p>
  
  <pre><code> typedef struct {
      HEADER header;
      INFOHEADER infoheader;
      PIXEL *pixel;
      } IMAGE;
  
  IMAGE imagenfte,imagendst;
  </code></pre>
  
  <p>this is my thread function</p>
  
  <pre><code>void *processBMP2(void *argumentos) 
  {
  thread_data *my_data;
  my_data =  (thread_data *) (argumentos);
  IMAGE *imagefte, *imagedst;
  imagefte =  my_data-&gt;imagenfte;
  imagedst = my_data-&gt;imagendst;
  free(my_data);
  int i,j;
  int count=0;
  PIXEL *pfte,*pdst;
  PIXEL *v0,*v1,*v2,*v3,*v4,*v5,*v6,*v7;
  int imageRows,imageCols;
  memcpy(imagedst,imagefte,sizeof(IMAGE)-sizeof(PIXEL *));
  imageRows = imagefte-&gt;infoheader.rows;
  imageCols = imagefte-&gt;infoheader.cols;
  imagedst-&gt;pixel=(PIXEL *)malloc(sizeof(PIXEL)*imageRows*imageCols);
  ...
  </code></pre>
  
  <p>and this is the way i`m creating the thread and passing de arguments</p>
  
  <pre><code>     pthread_t hilo;
  
  thread_data *my_data = (thread_data *) malloc(sizeof(thread_data));
  
  my_data-&gt;imagenfte = &amp;imagenfte;
  my_data-&gt;imagendst = &amp;imagendst;
  
  pthread_create(&amp;hilo,NULL, processBMP2, my_data);
  
  //processBMP(&amp;imagenfte,&amp;imagendst);
  </code></pre>