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

Function largest

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

Source from the content-addressed store, hash-verified

64}
65
66const double* largest(const double data[], size_t count)
67{
68 if (!count) return nullptr; // There is no largest in an empty array
69
70 size_t index_max {};
71 for (size_t i {1}; i < count; ++i)
72 if (data[index_max] < data[i])
73 index_max = i;
74
75 return &data[index_max];
76}
77
78double* scale_range(double data[], size_t count, double divisor)
79{

Callers 1

normalize_rangeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected