MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / array_sum

Function array_sum

week04/examples/unknow-size-array.cpp:5–14  ·  view source on GitHub ↗

float array_sum(float *values, size_t length) // equivalent to the next line

Source from the content-addressed store, hash-verified

3
4// float array_sum(float *values, size_t length) // equivalent to the next line
5float array_sum(float values[], size_t length)
6{
7 cout << sizeof(values) << endl; // 4 or 8
8 float sum = 0.0f;
9 for (int i = 0; i < length; i++)
10 {
11 sum += values[i];
12 }
13 return sum;
14}
15
16int main()
17{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected