Question: Define symbolic constants MAX_ROW = 3; MAX_COL = 5; Write a sum function that takes a two dimensional array with MAX_ROW and MAX_COL as its
Define symbolic constants
MAX_ROW = 3;
MAX_COL = 5;
Write a sum function that takes a two dimensional array with MAX_ROW and MAX_COL as its row/column sizes. Sum adds all the elements in the array and returns the sum.
Write a main function that initializes a two dimensional array int numbers[ MAX_ROW ] [ MAX_COL ] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5}. Then it calls the sum function to find the sum of all the numbers in the array. It prints the sum to the user.
I need this with out pointers *. I turned it in and thought it would be ok but no pointers are not allowed.
#include
using namespace std;
//initialize the row and column sizes const int MAX_ROW = 3; const int MAX_COL = 5; //Sum function to add all the elements in the array and returns the sum to main function int sum(int *numbers, int MAX_ROW, int MAX_COL) { //Local variable declaration int i, j, sum = 0; for (i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
