Objective
Write a function that fills a separate output buffer with the running totals of an integer array, one total per element.
Steps
$ int a[] = {1, 2, 3}; long out[3]; prefix_sum(a, 3, out);
1 3 6
$ int a[] = {5, -2, 7, -10}; long out[4]; prefix_sum(a, 4, out);
5 3 10 0
$ int a[] = {2000000000, 2000000000, 2000000000}; long out[3]; prefix_sum(a, 3, out);
2000000000 4000000000 6000000000
$ int a[] = {10, 20, 30, 40}; long out[4] = {-7, -7, -7, -7}; prefix_sum(a, 2, out);
10 30 -7 -7
$ int a[] = {7, 8, 9}; long out[3] = {-1, -1, -1}; prefix_sum(a, 0, out);
-1 -1 -1
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Objective
Write a function that fills a separate output buffer with the running totals of an integer array, one total per element.
Steps
$ int a[] = {1, 2, 3}; long out[3]; prefix_sum(a, 3, out);
1 3 6
$ int a[] = {5, -2, 7, -10}; long out[4]; prefix_sum(a, 4, out);
5 3 10 0
$ int a[] = {2000000000, 2000000000, 2000000000}; long out[3]; prefix_sum(a, 3, out);
2000000000 4000000000 6000000000
$ int a[] = {10, 20, 30, 40}; long out[4] = {-7, -7, -7, -7}; prefix_sum(a, 2, out);
10 30 -7 -7
$ int a[] = {7, 8, 9}; long out[3] = {-1, -1, -1}; prefix_sum(a, 0, out);
-1 -1 -1
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Tests
Run the tests to grade your code