// hi iam new programmer and i have a question what does nsensors mean in the function and in the if statement
Code:
#include<stdio.h>
#include<conio.h>
float avgtemp(int temperature[], int nsensors);
int main()
{
int tempreadings[10] = { 21, 17, 23, 26, 18, 14, 11, 19, 20, 15};
float average;
average = avgtemp(tempreadings, 10);
printf("\nthe average temperature is %.1f degrees. ",average);
getch();
}
float avgtemp(int dummy[], int nsensors) // what does nsensors due
{
float average = 0;
int j;
for(j=0; j<nsensors; j++)
average+= dummy[j]; // dont understant
if(nsensors >0) // dont understant
average /=nsensors;
return average;
}