是不是只有在传址调用时主调函数的类型说明符才可以是void?
#include <stdio.h>void fun ( int n ) //该行类型说明符应为double
{ int a, b, c, k; double s;
s = 0.0; a = 2; b = 1;
for ( k = 1; k <= n; k++ ) {
s = s + (double)a / b;
c = a; a = a + b; b = c;
}
return s;
}
main( )
{ int n = 5;
printf( "\nThe value of function is: %lf\n", fun ( n ) );
}