I'm going through Deitel's C++ How to Program, and I came across this rather strange exercise...
They're saying
Here's what I came up with:
Quote:
7.16 Label the elements of a 3-by-5 one-dimensional array
7.16 Label the elements of a 3-by-5 one-dimensional array
sales to indicate the order in which they are set to zero by the following program segment:for( size_t row = 0; row < 3; row++ )
for( size_t column = 0; column < 5; column++ )
sales[row][column] = 0;They're saying
sales is a one-dimensional array, but it's written as T sales[3][5];. I'm kind of unsure what this is supposed to mean... Did it mean a one-dimensional array of arrays? Or was it just a typo? I wasn't sure what to make of it, and I was hoping someone might be able to shed some light on it. :DHere's what I came up with:
int *firstArraySet = sales[0];
int *secondArraySet = sales[1];
int *thirdArraySet = sales[2];