Liste des Groupes | Revenir à cl c |
double average(double values[static 4]) {Not sure I follow. C doesn't care if its safe or not, it'll just try and
double total = 0.0;
for (int i = 0; i < 3; i++) {
total += values[i];
}
return total / 3;
}
>
Without the "static 4", the compiler can only assume that it can access up to 3 doubles from the "value" array. But with "static 4", it knows it is safe to read "values[3]" even though the code never needs to do
Les messages affichés proviennent d'usenet.