title: C initializing three dimensional array with math function?
body: <p>I am looking at past exams for a first year computer science course and I am confused about one question.  I have no idea what it's asking.  I am not asking someone to do it for me, but I would appreciate if someone could help me understand what the question wants me to do.</p>
  
  <p>Write a complete C program to allocate, initialize, print, and de-allocate a three-dimensional array of int type variables, according to the specifications below.  The sizes of the three array dimensions x, y, and z, are 3, 2, and 4, respectively.</p>
  
  <p>The array elements should be initialized according to the following function</p>
  
  <p>f(x,y,z) = 5x + 6y + 7z</p>
  
  <p>Which means your initialization code will look like this:</p>
  
  <p>myArray[x][y][z] = 5 * x + 6 * y + 7 * z;</p>
  
  <p>Here are some sample outputs:</p>
  
  <pre><code>0 7 14 21
  6 13 20 27
  
  5 12 19 26
  11 18 25 32
  
  10 17 24 31
  16 23 30 37
  </code></pre>
  
  <p>Firstly, I do not understand what the question is asking.  The only pattern I see is that each value is the prior value + 7.</p>
  
  <p>EDIT: Facepalm.  Thanks Andy. I thought it was totally something else.</p>