MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / smallest

Function smallest

Examples/NoModules/Chapter 08/Ex8_13.cpp:47–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47const double* smallest(const double data[], size_t count)
48{
49 if (!count) return nullptr; // There is no smallest in an empty array
50
51 size_t index_min {};
52 for (size_t i {1}; i < count; ++i)
53 if (data[index_min] > data[i])
54 index_min = i;
55
56 return &data[index_min];
57}
58
59double* shift_range(double data[], size_t count, double delta)
60{

Callers 1

normalize_rangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected