title: Determinant matrix calculating in C through pipe function. revision code
body: <p>Develop a program is performed using IPC mechanisms one of the following problems: The way - "Channels." Implement the computation of the determinant of a square matrix by expanding it on the determinants of lower order. The "master" process sends the job "driven" processes but the latter perform a calculation of determinants, and then calculates the result of the main process. In other words, need to use the pipe function. I have a working program but without IPC mechanisms. I don't know about pipe function and how it's working.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;math.h&gt;
  #include&lt;stdlib.h&gt;
  
  int determinant(int n, double mat[n][n])
  {
      int i,j,i_count,j_count, count=0;
      double array[n-1][n-1], det=0;
      if(n==1) return mat[0][0];
      if(n==2) return (mat[0][0]*mat[1][1] - mat[0][1]*mat[1][0]);
  
      for(count=0; count&lt;n; count++)
      {
          i_count=0;
          for(i=1; i&lt;n; i++)
          {
              j_count=0;
              for(j=0; j&lt;n; j++)
              {
                  if(j == count) continue;
                  array[i_count][j_count] = mat[i][j];
                  j_count++;
              }
              i_count++;
          }
          det += pow(-1, count) * mat[0][count] * determinant(n-1,array);
      }
      return det;
  }
  
  int main()
  {
      int i, j, dim;
      printf("Enter n\n");
      scanf("%d", &amp;dim);
      double matrix[dim][dim];
      printf("Enter matrix:\n");
      for(i = 0; i &lt; dim; i++)
      {
          for(j = 0; j &lt; dim; j++)
          {
              scanf("%lf \n", &amp;matrix[i][j]);
          }
      }
      double x = determinant(dim, matrix);
      printf("Determinant = %g\n", x);
      return 0;
  }
  </code></pre>