I'm trying to pass an array...and add up it's total, however i'm always getting 0 as my answer. Someone tell me what i'm doing wrong...thanks...eventually it's going to calculate standard deviation...but i need that dang array to be passed
Code:
#include <stdio.h>
#include <math.h>
int st_dev(float a[]);
int main()
{
float numbers[20];
int count;
printf("Enter 20 Numbers: ");
for (count = 0; count < 20; count++)
{
scanf( "%d", (numbers + count));
}
st_dev(numbers);
}
int st_dev(float a[])
{
float total;
for (int i = 0; i < 20; i++ )
{
total = total + a[i];
}
printf("%4.2f\n", total);
return total;
}