+ 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; }

23rd Nov 2017, 3:47 PM
mohsen tajik
mohsen tajik - avatar
2 Antworten
+ 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.
23rd Nov 2017, 5:31 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
thanks for help
23rd Nov 2017, 3:58 PM
mohsen tajik
mohsen tajik - avatar