C:设计一个函数 计算出整形数组的和

include int getAll(int array[],int length) { int sum = 0; for (int i = 0; i < length; i++) { sum+= array[i]; } return sum; } int main() { int array[] = {10,20,30,33,45,100}; int num = getAll(array,sizeof(array)/sizeof(int)); printf("the sum of this array is %d\n",num); return 0; }

Hibbs

0