Sum an array
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
数组求和
把 a 指向的 n 个整数加起来。像 const int *a 这样的指针用起来就和数组一样 —— a[i] 就是第 i 个元素。
难度 3/5 · 今日首次完成可获 200 金币及少量额外奖励
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.
点击“运行”查看此处输出。