Skip to content

Latest commit

 

History

History
14 lines (12 loc) · 311 Bytes

README.md

File metadata and controls

14 lines (12 loc) · 311 Bytes

2.25

float sum_elements( float a[], unsigned length) {
    int i;
    float result = 0;
    for ( i = 0; i <= length - 1; i++) {
        result += a[i];
    }
    return result;
}

The error: if we input the unsigned type length as 0, then length - 1 is the UMax, so the loop will never stop.