Sum an array · 数组求和
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
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.
中文
数组求和
把 a 指向的 n 个整数加起来。像 const int *a 这样的指针用起来就和数组一样 —— a[i] 就是第 i 个元素。
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. · 完成 int sum_array(const int *a, int n),返回这 n 个元素的和。不要写 main —— 检查器会提供。
Click Run to see the output here. · 点击“运行”查看此处输出。