sum rows & columns in array

This is a discussion on sum rows & columns in array within the C Programming forums, part of the General Programming Boards category; Howdy,
I need to take as input bi-dimensional array and summarize its columns (each column separately) & rows (each row ...

Do the same for columns. Basicly, your problem is you need an array which is as big as the total number of rows, so you can store the sum of each row in it. (Or, don't store it, and just display it instead. Then do the same for rows.

An example:

Code:

int array[2][2], rowtotals[2];
sumrows( array, rowtotals );

I won't do more than the pesudocode here, becuase that already does basicly all the work for you, not that you didn't make an effort.

Oh, and main returns an int, and you're just using pointers without actually making them point to something:

sum rows & columns in array

the problem is I'm not sure how do I treat the pointers. How do I link between them & my result of sum of the rows & columns.
Please explain it to me with the code of this program, this way I'll hopefully grab it better.

In addition, you seem to have a serious problem with missing { }'s, making your algorithm to run in a strange way. I suggest you always use the curly braces whatever the number of lines in the code structure (real-life shows that this number natural trend is growth).

An extra detail. I recommend that you define the variables on a unique line for each of them. Factorization is attractive, but it makes the code hard to maintain and to modularize. It also breaks my personnal C-rule: