title: Creating a function for a random number 2D array
body: <p>So, I have this code which I need to turn into a function:</p>
  
  <pre><code>int main(void)  {
      int i=0,seed;
      printf("\n\nEnter seed integer value: ");               
      scanf("%d", &amp;seed);                         
      printf("\nSeed value is:%d\n\n",seed);                  
      srand(seed);
  
  
  
      int a[5][5];                                
      int x,y;
      printf("Matrix A:\n");
      for(x=0;x&lt;5;x++)    {                       
          for(y=0;y&lt;5;y++)    {
              a[x][y] = rand() %51 + (-25);               
              printf("%d  ",a[x][y]); }           
          printf("\n");   }
      printf("\n\n");
  </code></pre>
  
  <p>So basically, it produces a 2D 5x5 array of random numbers. This works fine, however my next task is applying a function to this code, with the function name of:</p>
  
  <pre><code>void generate_matrices(int a[5][5])
  </code></pre>
  
  <p>I have tried multiple times, the closest I got to a successful code was:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  void generate_matrices(int a[5][5]);
  
  int main(void)  {
      int a, seed;
      printf("\n\nEnter seed integer value: ");               
      scanf("%d", &amp;seed);
      srand(seed);
      printf("\nSeed value is:%d\n\n",seed);  
  
      generate_matrices(a);
  
      return 0;
  }
  
  
  void generate_matrices(int a[5][5]) {
  
      int y,z;
      printf("Matrix A:\n");
      for(y=0;y&lt;5;y++)    {
          for(z=0;z&lt;5;z++)    {
               a[y][z] = rand() %51 + (-25);  }   
      printf("%d  ",a[y][z]); }
      printf("\n");
      }
  </code></pre>
  
  <p>But this returns the error, "expected 'int(*)[5]' but arguement is of type 'int'.</p>
  
  <p>All/any help is muchly appreciated. To be fair on my part, I have done 90% of the code. This is the only bit I need help with so that I can apply this to the rest of my code.</p>
  
  <p>Cheers!</p>