i'm sorry, the code that i have posted before is the wrong code before las editing.
exactly the code like this
Code:
int main()
{
float av,prc,i,j,k;
scanf("%f %f %f", &i, &j, &k);
mak(i,j,k,&av,&prc);
printf("\n%f %f",av,prc);
return 0;
}
mak(float a, float b, float c, float *d, float *e)
{
*d=(a+b+c)/3;
*e=*d;
}
as hk_mp5kpdw said, i swap the position of those function, it turn out like this.
Code:
#include <stdio.h>
#include <stdlib.h>
mak(float a, float b, float c, float *d, float *e)
{
*d=(a+b+c)/3;
*e=*d;
}
int main()
{
float av,prc,i,j,k;
scanf("%f %f %f", &i, &j, &k);
mak(i,j,k,&av,&prc);
printf("\n%f %f",av,prc);
return 0;
}
amazingly, it works. it makes questions in my mind.
1.how can just swapping the position of functions makes it works?
2.and, what's wrong with the first code(before swapping)?why it goes error?