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.
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.
The array elements should be initialized according to the following function
f(x,y,z) = 5x + 6y + 7z
Which means your initialization code will look like this:
myArray[x][y][z] = 5 * x + 6 * y + 7 * z;
Here are some sample outputs:
0 7 14 21
6 13 20 27
5 12 19 26
11 18 25 32
10 17 24 31
16 23 30 37
Firstly, I do not understand what the question is asking. The only pattern I see is that each value is the prior value + 7.
EDIT: Facepalm. Thanks Andy. I thought it was totally something else.