-1

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;
}
CubeJockey
  • 2,209
  • 8
  • 24
  • 31
vamoirid
  • 39
  • 6

1 Answers1

4

You are missing the radius:

you typed: circle(r,float *p,float *s)

but what is r in the parameter? correct this by doing:

void circle(float r, float *p,float *s)
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97