2-D array sum of rows/ columns

For some reason my program will not add up the columns. It will print out the row sums but rounded down to the lowest integer. I can not figure out why it is doing this.
Last edited on
1
2
arrayOfSales[5][NUMBERCOLUMNS] = total; // Illegal. You are trying to access an out of bounds index. 
                                   //Column Index numbers are 0 to NUMBERCOLUMNS-1. 

Similarly for the other function.

Also, the statement arrayOfSales[][] = total; should be out of the inner loop.


Last edited on
Thanks!
Last edited on
You have declared total as an int.
*face palm*
Topic archived. No new replies allowed.