1
I need to use pointers, but I’m not sure how to express the syntax, it’s part of the goal of the task (change the value of the parameters passed by reference to the functions, such that these variables are printed in the main().
#include <stdio.h>
#define MAX 3
void busca_menor( float *notas, float tam)
{
int i;
float m, valor;
m=notas[0];
for(i=0; i<tam; i++)
{
if (notas[i]<m)
{
m=notas[i];
}
}
}
int main()
{
int i;
float notas[MAX], valor;
printf("Informe a nota de 3 alunos: ");
for (i=0; i<MAX; i++)
{
scanf("%f", ¬as[i]);
}
busca_menor(notas, MAX);
printf(" A menor nota foi: ");
printf("%2.f", MAX);
}
What is the error shown?
– Maniero
It does not return the lowest value among those informed by the user.
– RafNP
You said you don’t even compile, so you make a mistake.
– Maniero
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero