There are a lot of little errors here...
First off
double Sum(double matrixA[SIZE], double matrixB[SIZE]) needs to be declared as:
double Sum(double matrixA[][SIZE], double matrixB[][SIZE]) This is because you want the matrices to be multiDimentional arrays, not single dimentional arrays.
Next up
double matrixAddition = Sum(matrixA[SIZE][SIZE], matrixB[SIZE][SIZE]); is passing two doubles (matrixA[10][10] and MatrixB[10][10]) and you MEAN to pass the arrays:
double matrixAddition = Sum(matrixA, matrixB);Taking from that one:
inside of Sum() you have
return(matrixC[SIZE][SIZE]); and this compiles fine, but it is a logic error. It translates to:
return(matrixC[10][10]); but the array is only defined to [9][9] (elements go from 0 to SIZE-1) so even if you DID mean to just return one element of the matrix, that element would be outside of your allocated memory... but what I belive you mean to return is the array itself (i.e. the SUM of the two matrices). The problem here is that C/C++ does not directly allow you to return multidimential arrays. You see matrixC exits in the stack space for the function call to Sum(), when Sum() exits, matrixC is thown away so even if you COULD return a pointer to matrixC (arrays are passed by referance... i.e. pointers) it would not really exits outside of Sum(). So what do we do???
We change the way sum works. There are two options:
Option1: we store the result of the addition is matrixA, this makes sum kinda like going
matrixA += matrixB; (in fact overloading the += operator might be nice).
Option2: we pass matrixC as a parameter to sum().
void Sum(double matrixA[][SIZE], double matrixB[][SIZE], double matrixC[][SIZE]); Then all we have to do is remove the delcaration of matrixC from inside of Sum() (i.e. delete the line
double matrixC[SIZE][SIZE]; and change the return stament to
return; to mark our exit point.
Problem #4
if(rows == columns2 && rows2 == columns)rows, columns2, rows2, columns <-- none of these are initalized, so the above if statment is capable of doing all kinds of strange things. Basicly you need to either initalize these variables or get rid of that line.
That all being said,
Here is an example of another way to handel matrices (this is an example of row operations). In that post I recommend a different stratigy for representing matricies, I think that a class would be a much better solution, but rather than using static multidimentinal arrays, this example uses a structure and a pointer to a dynamic array. This idea might help deal with ensuring that yours rows=collums to do the addition.