I can run the following program

Code:

#include<stdio.h>
main()
{
int i,j;
printf("enter number \n");
scanf("%d",&i);
j=we(i);
printf("%d",j);
}
int we(int a)
{
a=a+1;
return a;
}

It does not have a function prototype but it works

But I applied the same concept in using arrays accessing a function which takes a float as an input and produces a float as an out put it is as follows

Code:

#include<stdio.h>
#define p 3.14
main()
{
int n,i=0;
float rad[100],area[100];
printf("enter rad\n");
printf(" rad?\n");
scanf("%f",&rad[i]);
while(rad[i])
{
if (rad[i]<0)
area[i]=0;
else
area[i]=process(rad[i]);
printf(" rad2?\n");
scanf("%f",&rad[++i]);
}
n=--i;
printf("summary of results\n");
for (i=0;i<=n;++i)
printf("rad = %f area = %f\n",rad[i],area[i]);
}
float process(float r2)
{
float a;
a=p*r2*r2;
printf("%f",a);
return (a);
}

But this program compiles but does not calculate the value

a=p*r2*r2;

because when I checked inside PROCESS the r2’s value=0

can anybody help me please?

Thanks in advance