title: Syntax error : missing ';' before 'type'
body: <p>So i have this error:</p>
  
  <blockquote>
    <p>Error 3   error C2143: syntax error : missing ';' before
    'type'    g:\lel\tommy\tommy\tommy.c  34  tommy</p>
  </blockquote>
  
  <p>from this block of code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  #include &lt;malloc.h&gt;
  #include &lt;conio.h&gt;
  
  struct matrep {
        unsigned rows,cols;
        double *matrix;
  };
  
  int matrix_read(struct matrep *mat, const char *filename)
  {
      FILE *fptr;
      unsigned m, n;
  
      if ((fptr = fopen(filename, "r")) == NULL)
      {
          fprintf(stderr, "Cannot Open File %s\n", "matrixA.txt");
          return -1;
      }
      if (fscanf(fptr, "\n\nnrows %u, columns %u\n\n", &amp;m, &amp;n) != 2)
      {
          fprintf(stderr, "Failed to read dimensions\n");
          return -1;
      }
  
      mat-&gt;matrix = (double *)malloc(sizeof(double) * m * n);
      if (mat-&gt;matrix == 0)
      {
          fprintf(stderr, "Failed to allocate %d*%d matrix\n", m, n);
          return -1;
      }
      double *ptr = mat-&gt;matrix;//this is where it says that the error occured.
  
      for (int i = 0; i &lt; m; i++)
      {
          for (int j = 0; j &lt; n; j++)
          {
              double x;
              if (fscanf(fptr, "  %5.2lf", &amp;x) != 1)
              {
                  fprintf(stderr, "Failed to read element matrix[%d,%d]\n", i, j);
                  free(mat-&gt;matrix);
                  mat-&gt;matrix = 0;
                  mat-&gt;columns = 0;
                  mat-&gt;rows = 0;
                  return -1;
              }
              *ptr++ = x;
          }
      }
      fclose(fptr);
      mat-&gt;columns = m;
      mat-&gt;rows = n;
  
      return 0;  // Success   
  }
  
  int main(int argc, _TCHAR* argv[])
  {
      return 0;
  }
  </code></pre>
  
  <p>I have no idea what that means, or where I'm making the mistake. Please help.</p>
  
  <p>UPDATE:</p>
  
  <p>While the original question was solved, i have received the exact same error, but in another block of code, and I'm writing as per recommended by the chosen answer:</p>
  
  <pre><code>int matrix_multiplication(struct matrep *mat_left,struct matrep *mat_right,struct matrep *result)
  {
      if(mat_left-&gt;cols != mat_right-&gt;rows)
      {
          fprintf(stderr, "The number of columns from the left matrix are different from the number of colums from the right matrix");
          return -1;
      }
      double *p = NULL;//this is where the same error occurs the first time
      double *pa = NULL;
      int i,j;
      result-&gt;rows = mat_left-&gt;rows;
      result-&gt;cols = mat_right-&gt;cols;
  
      p = result-&gt;matrix;
      for (pa = mat_left-&gt;matrix, i = 0; i &lt; mat_left-&gt;rows; i++, pa += mat_left-&gt;cols)
          for (j = 0; j &lt; b-&gt;w; j++)
              *p++ = dot(pa, mat_right-&gt;matrix + j, mat_left-&gt;cols, mat_right-&gt;cols);
      return 0;
  }
  </code></pre>
  
  <p>I'm really lost here, I am reading this code and have no idea why it gives me the same error.</p>