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

Function arraySum

week07/examples/lab/mymath.cpp:4–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include "mymath.h"
3
4float arraySum(const float *array, size_t size)
5{
6 if(array == NULL)
7 {
8 std::cerr << "NULL pointer!" << std::endl;
9 return 0.0f;
10 }
11 float sum = 0.0f;
12 for(size_t i = 0; i < size; i++)
13 sum += array[i];
14 return sum;
15}

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected