#include<stdio.h>
int main()
{
int x;
float peri ,area1;
scanf("%d",&x);
area(x, &peri, &area1);
printf(" %f %f ", peri, area1);
return 0;
}
int area(int r, float *per, float *are)
{
*per = 2.0 * r;
*are = 3.14 * r * r;
}
This works fine but when I try to change the input value to float
#include<stdio.h>
int main()
{
float x, peri, area1;
scanf("%f",&x);
float area(x, &peri, &area1);
printf(" %f %f ", peri, area1);
return 0;
}
float area(float r, float *per, float *are)
{
*per = 2.0 * r;
*are = 3.14 * r * r;
}
I get:
error: expected ‘)’ before ‘&’ token
should be
You don’t need to specify the return type when you are calling the function.
Also since the return type now is non-int you need to either:
Provide a function declaration like:
before main.
Also since you are not returning anything from the function you should be making its return type as
void.