hey, it is me again. I have another question in my mind, ok, this is the code:
Code:
#include<stdio.h>
#define max 15
void average5(double a[]);
int main(void)
{
static double rain[3][5]={
{1,1,1,1,1},
{2,2,2,2,2},
{3,3,3,3,3}};
average5(rain);
system("pause");
return 0;
}
void average5(double a[])
{
int a1;
double subtot;
for(a1=0;a1<15;a1++)
{
if(a1%5==0)
subtot=0;
subtot+=*(a+a1);
if(a1%5==4)
printf("the 5 average is %.1lf ",subtot/5);
}
}
I pass the array name "rain" to average5() which takes a double pointer argument. The compiler only told me this is an imcompatible pointer type, but the program itself still can run and showing the correct result. any idea about this?