#include%26lt;stdio.h%26gt;
main()
{
int radius;
float area,perimeter;
printf("\n Enter the radius of a circle");
scanf("%d",%26amp;radius);
areaperi(radius,%26amp;area,%26amp;perimeter);
printf("Area=%f",area);
printf("\n Perimeter=%f",perimeter);
}
areaperi(int r, float *a, float *p)
{
*a=3.14*r*r;
*p=2*3.14*r;
}
I tried to run this pgm in both turbo c%26amp;dev,i am getting error in turbo,but in dev it will compile,no res y?
You have to declare the function before main() like this
areaperi(int , float *, float *); or you can move the entire function before main().
The error you are getting in turbo c is because, when the areaperi is encountered while running main, will be unknown.
Reply:You also need to declare the return type of the functions:
int main()
float areaperi(int,float*,float*)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment