B
Bill Cunningham
I am trying here to calculate a mean of 3 values. I do not understand
the errors the compiler returned I've never seen them.
#include <stdio.h>
void mean(double *avg, int periods)
{
double val;
val = *avg / periods;
printf("%.2f\n", val);
}
int main(void)
{
double a[] = 2.2, 4.2, 5.00;
mean(a, 3);
}
p.c: In function `main':
p.c:12: invalid initializer
p.c:12: parse error before numeric constant
What's it trying to tell me?
Bill
the errors the compiler returned I've never seen them.
#include <stdio.h>
void mean(double *avg, int periods)
{
double val;
val = *avg / periods;
printf("%.2f\n", val);
}
int main(void)
{
double a[] = 2.2, 4.2, 5.00;
mean(a, 3);
}
p.c: In function `main':
p.c:12: invalid initializer
p.c:12: parse error before numeric constant
What's it trying to tell me?
Bill