Sum an array
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Sum an array
Add the n integers that a points to. A pointer like const int *a works just like an array — a[i] is the i-th element.
Complete int sum_array(const int *a, int n) to return the sum of the n elements. Do not write main — the checker provides one.
Click Run to see the output here.