Skip to content
UPEEC

Function Definitions

The function's body — where the work happens.

Beginner
Comments 0
float average(const float *v, size_t n) {
    float s = 0;
    for (size_t i = 0; i < n; i++) s += v[i];
    return n ? s / n : 0;
}

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.