The function I'm making is supposed to return to the maximum value in a vector, and I'm stumped as to why it's not working, here is the code (I'm new to this site so the formatting will be terrible, apologies):
float max(float vec[], int len) {
int i;
float max;
for (i=0; i < len; i++) {
if (vec[i] > max) {
max = vec[i];
}
}
return max;
}
Aucun commentaire:
Enregistrer un commentaire