I started to read about pointers and I tried to write code for a problem in which the user gives me the radius of a circle and I return to him the perimeter and the surface. When I run this code the compiler shows this :
example.c:16:15: error: expected ‘)’ before ‘float’
void circle(r,float *p,float *s)
^
My code:
#include <stdio.h>
float pi=3.14159;
void circle(float ,float *,float *);
int main()
{
float radius,perimeter,surface;
printf("insert the radius of the circle\n");
scanf("%f",&radius);
circle(radius,&perimeter,&surface);
printf("the perimeter is %f and the surface is %f\n", perimeter, surface );
return 0;
}
void circle(r,float *p,float *s)
{
*p=2*pi*r;
*s=pi*r*r;
}