下面被调用函数sub的函数值的类型是( ) sub(float A) {float b; b=a*a+1; return b; }
A.单精度型
B.双精度型
C.空类型
D.整型
第1题:
若主调用函数类型为double,被调用函数定义中没有进行函数类型说明,而return语句中的表达式类型为float型,则被调函数返回值的类型是()。
A.int型
B.float型
C.double型
D.由系统当时的情况而定
第2题:
A. long 型
B. float 型
C. double型
D. int型
第3题:
若各选项中所用变量已正确定义,函数 fun 中通过 return 语句返回一个函数值,以下选项中错误的程序是
A)
main()
{ …… x=fun(2,10); …… }
float fun(int a,int b){ …… }
B)
float fun(int a,int b){ …… }
main()
{ …… x=fun(i,j); …… }
C)
float fun(int,int);
main()
{ …… x=fun(2,10); …… }
float fun(int a,int b) { …… }
D)
main()
{ float fun(int i,int j);
…… x=fun(i,j); …… }
float fun(int a,int b){ …… }
第4题:
下列函数值的类型是( )。 fun(double x) { float y; y=3*x-4; return y; }
A.int
B.不确定
C.void
D.float
第5题:
阅读以下说明和C语言函数,将应填入(n)处的字句写在对应栏内。
[说明]
编写一个函数,输入为偶数时,调用函数求1/2+?/+…+1/n,当输入n为奇数时,调用函数1/1+1/3+…+1/n (利用指针函数)。
[函数]
include "stdio. h",
main()
{
float peven (),podd (),dcall ();
float sum;
int n;
while (1)
{
scanf("%d",&n);
if (n>1)
break;
}
if(n%2==0)
{
printf("Even="):
(1);
}
else
{
pfinff("Odd=");
(2);
}
printf("%f",sum);
}
float peven (int n)
{
float s;
int i
s=1;
for(i=2;i<=n;i+=2)
(3);
return (s);
}
float podd (n)
int n;
{
float s;
int i;
s=0;
for(i=1 i<=n;i+=2)
(4);
return (s);
}
float dcall(fp,n)
float (*fp) ();
int n;
{
float s;
(5);
returu (s);
}
第6题:
下面各被调用函数首部书写正确的是( )
A.void sub(float x;float y);
B.void sub(float x,y)
C.void sub(float x,float y)
D.void sub(float x,float y);
第7题:
第8题:
A.float型
B.int型
C.long型
D.double型
第9题:
以下函数值的类型是 ( ) fun (float x) { float y; y=3 * x-4; return y; }
A.int
B.不确定
C.void
D.float
第10题:
以下函数值的类型是______。 fun(floatx) { float y; y=3*x-4; return y; }
A.int
B.不确定
C.void
D.float