Skip to the content of the web site.

Project W.7: Partial sums

The partial sum function replaces the kth entry of the array with the sum of that entry and all previous entries. This operation is performed in-place.

Integer implementation

void partial_sums( int array[], std::size_t capacity );

Templated implementation

template <typename T>
void partial_sums( T array[], std::size_t capacity );