
Write a function that fills an output array with the sum of each row of a 2D grid whose rows are exactly four integers wide.
int grid[2][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}}; row_sums(grid, 2, out);Expected result
10 26For your own tracking. Tests grade your code.
int grid[3][4] = {{1, 2, 3, 4}, {10, 20, 30, 40}, {100, 200, 300, 400}}; row_sums(grid, 3, out);Expected result
10 100 1000int out[3] = {-1, -1, -1}; row_sums(grid, 0, out);Expected result
-1 -1 -1Expected files
row_sums.cAllowed functions
None. Write every helper yourself.
Allowed headers

v0.40: Create exercises. Challenge the community.
Meet Studio →Write a function that fills an output array with the sum of each row of a 2D grid whose rows are exactly four integers wide.
int grid[2][4] = {{1, 2, 3, 4}, {5, 6, 7, 8}}; row_sums(grid, 2, out);Expected result
10 26For your own tracking. Tests grade your code.
int grid[3][4] = {{1, 2, 3, 4}, {10, 20, 30, 40}, {100, 200, 300, 400}}; row_sums(grid, 3, out);Expected result
10 100 1000int out[3] = {-1, -1, -1}; row_sums(grid, 0, out);Expected result
-1 -1 -1Expected files
row_sums.cAllowed functions
None. Write every helper yourself.
Allowed headers

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.