更多"[单选题]有以下程序
fun(int x)
{int p;
if(x="的相关试题:
[单选题]有以下程序
fun(int x,int y){return(x+y);}
main()
{int a=1,b=2,c=3,sum;
sum=fun((a++,b++,a+b),c++);
printf("%d\n",sum); }
执行后的输出结果是()。
A.6
B.7
C.8
D.9
[单选题]有以下程序
int fun(int n)
{if(n==1)return 1;
else
return(n+fun(n-1));
}
main()
{int x;
scanf("%d",&x); x=fun(x);printf("%d\n",x);
}
执行程序时,给变量X输入10,程序的输出结果是()。
A.55
B.54
C.65
D.45
[单选题]已定义以下函数
int fun(int *p)
{return *p;)
fun函数返回值是()。
A.不确定的值
B.一个整数
C.形参P中存放的值
D.形参P的地址值
[单选题]有以下程序
int fun(int x,int y,int *cp,int *dp)
{ *cp=x+y; *dp=x-y; }
main()
{ int a, b, c, d;
a=30; b=50;
fun(a,b,&c,&d);
printf("%d,%d\n", c, d);
}
输出结果是()。
A.50,30
B.30,50
C.80,-20
D.80,20
[单选题]有以下程序
int fun(int x[],int n)
{static int sum=0,i;
for(i=0;iA.45
B.50
C.60
D.55
[单选题]有以下程序
fun(int x)
{ int p;
if(x==0||x==1) return(3);
p=x-fun(x-2);
return p;
}
main()
{ printf("%d\n",fun(7)); }
执行后的输出结果是( )。
A.7
B.3
C.2
D.0
[单选题]有以下程序
fun(int x,int y)
{static int m=0,i=2; i+=m+1;m=i+x+y; return m; }
main()
{int j=1,m=1,k;
k=fun(j,m); printf("%d,",k);
k=fun(j,m);
printf("%d\n",k);
}
执行后的输出结果
A.5,5
B.5,11
C.11,11
D.11,5
[单选题]有以下程序段
struct st
{int x;int *y;}*pt;
int a[]={1,2},b[]={3,4};
struct st c[2]={10,a,20,b};
pt=c;
以下选项中表达式的值为11的是()。
A.*pt->y
B.pt->x
C.++pt->x
D.(pt++)->x
[单选题]以下程序的输出是()。
struct st
{ int x; int *y;} *p;
int dt[4]={ 10,20,30,40 };
struct st aa[4]={ 50,&dt[0],60,&dt[0],60,&dt[0],60,&dt[0],};
main()
{ p=aa;
printf("%d\n",++(p->x));
}
A.10
B.11
C.51
D.60
[单选题]22.设有以下程序段
int x=0,s=0;
while(!x!=0)s+=++x;
printf("%d",s);
则()。
A.运行程序段后输出0
B.运行程序段后输出1
C.程序段中的控制表达式是非法的
D.程序段执行无限次
[单选题]有以下程序
#include “stdio.h”
fun(int x, int y){ return (x+y); }
void main()
{ int a=1, b=2, c=3, sum;
sum=fun((a++,b++,a+b),c++);
printf("%d\n",sum);
}
执行后的输出结果是( )。
A.6
B.7
C.8
D.9
[单选题]有以下程序
#include
void fun(int *x,int i)
{*x=*(x+i);}
void main()
{ int a[8]={1, 2, 3, 4, 5, 6, 7, 8},i;
fun(a,2);
for(i=0; i<8/2; i++)
{ printf("%d",a[i]);}
printf("\n");
}
执行后的输出结果是( )。
A.3234
B.3231
C.2334
D.2331
[单选题]有以下程序
#include
struct tt
{int x;struct tt *y;} *p;
struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
void main()
{
int i;
p=a;
for(i=1;i<=2;i++)
{printf("%d,",p->x); p=p->y;}
}
执行后的输出结果是( )。
A.20,15,
B.20,14,
C.28,13,
D.15,20,
[单选题]以下程序的输出结果是()。
union myun
{ struct
{ int x, y, z; } u;
int k;
} a;
main()
{ a.u.x=4; a.u.y=5; a.u.z=6;
a.k=0;
printf("%d\n",a.u.x);}
A.4
B.5
C.6
D.0
[单选题]以下程序的输出结果是()。
struct HAR
{ int x, y; struct HAR *p;
} h[2];
main()
{h[0].x=1;
h[0].y=2;
h[1].x=3;
h[1].y=4;
h[1].p=&h[1];
h[1].p=h;
printf("%d %d \n",(h[0].p)->x,(h[1].p)->y);
}
A.1 2
B.2 3
C.1 4
D.3 2
[单选题]有以下程序
#include
void ive(x,n)
int x[],n;
{ int t,*p;
p=x+n-1;
while(x
A.1 2 3 4 5 6 7 8 9 0
B.0 9 8 7 6 5 4 3 2 1
C.1 3 5 7 9 2 4 6 8 0
D.0 8 6 4 2 9 7 5 3 1
[单选题]有以下程序
int add(int a,int b){return+b};}
main()
{int k,(*f)(),a=5,b=10;
f=add;
... }则以下函数调用语句错误的是()。
A.k=(*f)(a,b);
B.k=add(a,b);
C.k=*f(a,b);
D.k=f(a,b);
[单选题]有以下程序
#include
int fun (int x,int y)
{ if (x!=y) return ((x+y)/2);
else return (x);
}
main()
{ int a=4,b=5,c=6;
printf("%d\n",fun(2*a,fun(b,c)));
}
程序运行后的输出结果是 ()。
A.3
B.6
C.8
D.12
[单选题]以下程序的输出结果是()。
func(int a,int b)
{ int c;
c=a+b;
return c;}
main( )
{ int x=6,y=7,z=8,r=0;
r=func((x--,y++,x+y),z--);
printf(“%d\n”,r);}
A.11
B.20
C.21
D.31