2d array

Can someone explain how to find the sum of a 2d array or point me in the direction of a good tutorial?

example:

int grade[5][4]={99.4,56.7,23.4,67.8,100}
Last edited on
I guess it depends what you want to add up. A 2d array is like a table of rows and columns.

If you wanted to add up all the numbers in one row, you'd hold the row number fixed and iterate through the column numbers. Or if you wanted to add up all the numbers in one column, you'd hold the column number fixed and iterate through the row numbers.

If you scroll down on this page, there's a section on multidimensional arrays.
http://www.cplusplus.com/doc/tutorial/arrays/
Topic archived. No new replies allowed.