At line 12 compiler gives error....`float*' to `float' for argument `6' to `int fun(int, int, int, int, int, float, float)'

could anyone plz tell me, where i m wrong......... Thanks

#include<stdio.h>
#include<conio.h>

int fun(int,int,int,int,int,float,float);
int main()
{
	int a1,a2,a3,a4,a5;
        float avg=0.0,sum=0.0;
	
	printf("Enter the five values");
	scanf("%d %d %d %d %d",&a1,&a2,&a3,&a4,&a5);
	fun(a1,a2,a3,a4,a5,&sum,&avg);

        printf("%d %f",sum,avg);
	getch();
}

int fun(int b1,int b2,int b3,int b4,int b5,float *sum,float *avg)
{
     *sum=b1+b2+b3+b4+b5;
     *avg=(*sum/5);
  //   printf("%d %d %d %d %d",b1,b2,b3,b4,b5);
}

Your prototype of fun says that sum and avg are floats. Your definition says that sum and avg are pointers to float. Make up your mind.

Change your definition of fun to int fun(int,int,int,int,int,float*,float*); Remember you are dealing with pointers

Thanksssssssssssssss a lot.........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.