+ 1
syntax error
how to solve syntax error code below #include<stdio.h> #include<conio.h> float area(float); float perimeter(float); #define p 3.14 int main() { float r; scanf("%f",&r); printf("s= %f\np= %f",area(),perimeter()); } float area(float s) { float s; s=p*r*r; return s; } float perimeter(float p) { float p; p=2*p*r; return p; }
2 Answers
+ 2
float r;
This definition must be outside of main, or r must be a parameter of perimeter and area.
In addition, area and perimeter are defined as functions with parameter, but called without parameter.
+ 1
thanks for help