0

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);
}
3
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by ram619
0

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.

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.