vault backup: 2024-11-01 13:28:59
This commit is contained in:
parent
0cbe502348
commit
0870e5ab2b
@ -21,9 +21,10 @@ int i;
|
|||||||
*sum = 0.0;
|
*sum = 0.0;
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
// This wasn't increasing the value
|
// This wasn't increasing the value
|
||||||
// `sum` points to, it was modifying the address the pointer po
|
// `sum` points to, it was modifying the address stored in the pointer
|
||||||
(*sum) += a[i];
|
(*sum) += a[i];
|
||||||
avg = sum / n;
|
// Missing dereference operators
|
||||||
|
*avg = *sum / n;
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user