title: cast to pointer from integer of different size, pthread code
body: <p>I have this code for matrix multiplication, using pthreads, but I get the error "cast to pointer from integer of different size"</p>
  
  <p>I don't know what is wrong.I am new to pthread, and this is what I have made so far:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  #include &lt;sys/time.h&gt;
  #include &lt;pthread.h&gt;
  
  #define NTHREADS 4
  
  int dim ;
  pthread_mutex_t m;       /* Mutex protecting the sum value */
  pthread_t thread_id[NTHREADS];  /* Thread ids */
  float **A, **B, **C;
  
  void *prod (void *s){
      int *id=(int *)s;
      int idd=*id;
  
  
      /* Define local variables */
      int i,j,k, start, end, len ;
      float **Aa, **Bb, **Cc;
  
      start = dim*idd;       /* Start of this threads slice of the vectors */
      end   = start + dim;      /* End of the slice */
  
  
      for (i = 0 ; i &lt; dim; i++)
      {
          for (j = 0;  j &lt; dim; j++)
          {
              Cc[i][j] = 0;
              for (i=start; i&lt;end ; i++) {
  
                  Cc[i][j] += Aa[i][k] * Bb[k][j];
              }
          }
      }
      pthread_mutex_lock (&amp;m);     /* Lock the mutex */
      C[i][j] += Cc[i][j];                /* Update the shared variable */
      pthread_mutex_unlock (&amp;m);   /* Unlock the mutex */
  
      pthread_exit(NULL);            /* Done! */
  }
  
  int main ( int argc, char *argv[] )
  {
      void *status;
      float **A, **B, **C;
      int i,j,k;
  
      if ( argc == 2)
          dim = atoi(argv[1]); // get the dimension of the matrix
      // from the command prompt
  
      else
          dim = 128;
  
  
  
      A = (float **)malloc(sizeof(float*)*dim);
      B = (float **)malloc(sizeof(float*)*dim);
      C = (float **)malloc(sizeof(float*)*dim);
  
      for (i = 0 ; i &lt; dim; i++)
      {
          A[i] = (float *)malloc(sizeof(float)*dim);
          B[i] = (float *)malloc(sizeof(float)*dim);
          C[i] = (float *)malloc(sizeof(float)*dim);
      }
  
      for (i=0; i&lt;dim; i++)
      {
          for (j = 0 ; j &lt; dim; j++)
          {
              A[i][j]=rand();
              B[i][j]=rand();
          }
      }
  
      struct timeval t1, t2;
      gettimeofday(&amp;t1, NULL);
  
      // you need to parallelize this
      // perform the multiplication
      for(i=0;i&lt;NTHREADS;i++) {
  
          pthread_create(&amp;thread_id[i], NULL, prod, (void *)i);
      }
      /* Wait on the other threads */
      for(i=0;i&lt;NTHREADS;i++) {
          pthread_join(thread_id[i], &amp;status);
      }
  
      gettimeofday(&amp;t2, NULL);
  
      double t = (t2.tv_sec - t1.tv_sec) + (t2.tv_usec - t1.tv_usec ) / 1000000.0;
      // take the difference and report it in seconds
      printf("execution time %f seconds\n",t);
  }
  </code></pre>
  
  <p>the error at this line: </p>
  
  <pre><code>pthread_create(&amp;thread_id[i], NULL, prod, (void *)i); 
  </code></pre>