填空题以下程序运行后的输出结果是______。
fun(int a)
{ int b=0; static int c=3;
b++;c++;
return(a+b+c);
}
main()
{ int i,a=5;
for(i=0;j<3;i++)printf("%d %d",i,fun(a));
printf("/n");
}
填空题下列给定程序中,函数fun的功能是:计算整数n的阶乘。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,
也不得更改程序的结构。
试题程序:
#include<stdlib.h>
#include<stdio.h>
double fun(int n)
{
double result=1.0;
while(n>1
/**********found**********/
return;
}
void main()
{
int n;
system("CLS");
printf("Enter an integer:");
scanf("%d",
printf("/n/n%d!=%ld/n/n",n,fun(n));
}
填空题设栈的存储空间为S(1 : 40),初始状态为bottom = 0, top = 0,经过一系列入栈与出栈运算后,top = 20,则当前栈中有U [2] /U个元素。
填空题以下程序运行后的输出结果是______。
#include<stdio.h>
void fun(char*a1, char*a2, int n)
{ int k;
for(k=0; k<n; k++) a2[k1=(a1[_k]-'A'-3+26)%26+'A';
a2[n]='/0';
}
main()
{char s1[5]="ABCD", s2[5];
fun(s1, s2, 4); puts(s2);
}
填空题以下程序运行后的输出结果是 【20】 。 #include <stdio.h> fun(int x) if(x/2>0) fun(x/2); printf("%d",x); main() fun(6);
填空题以下程序中,函数SumColumMin的功能是:求出M行N列二维数组每列元素中的最小值,并计算它们的和值,和值通过形参传回主函数输出。请填空, #include <stdio.h> #define M 2 #define N 4 void SumColumMin ( int a [M] [N] ,int* sum) int i,j,k,s=0; for(i =0;i<N;i ++ ) k=O; for(j=1 ;j < M;j ++ ) if(a[k][i] >a[j][i]) k=j; s+:{{U}} {{/U}}; {{U}} {{/U}}=s; main( ) int x[M] [N]=3,2,5,1,4,1,8,3,s; SumColumMin({{U}} {{/U}}); printf( "%d //n" ,s);
填空题下列给定程序中,函数fun()的功能是求出数组中最小数和次最小数,并把最小数和a[0]中的数对调,次最小数和a[1]中的数对调。
请改正程序中的错误,使它能得到正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <conio.h>
#include <stdio.h>
#define N 20
void fun(int *a,int n)
{
int i, m,t,k;
/*************found**************/
for(i=O; i<n; i++)
{
m==i;
for(k=i; k<n; k++)
if(a[k]<a[m])
/*************found**************/
k=m;
t=a[i];
a[i]=a[m];
a[m]=t;
}
}
main()
{
int x,b[N]={11,5,12,0,3,6,9,7,10,8},
n=10,i;
clrscr();
for(i=0; i<n; i++)
printf("%d",b[i]);
printf("/n");
fun(b,n);
for(i=0; i<n; i++)
printf("%d",b[i]);
printf("/n");
}
填空题函数fun的返回值是______。 fun(char *a,char *b) int num=0,n=0; while(*(a+num)!='/0')num++; while(b[n]) *(a+num)=b[n];num++;n++; return num;
填空题以下程序的输出结果是【 】。
int fun(int *x,int n)
{if(n=0) return x[0];
else return x[0]+fun(x+1,n-1);
}
main( )
{int a[]={1,2,3,4,5,6,7};printf("%d\n",fun(a,3));}
填空题有以下程序:
#include <stdio.h>
main()
{ int n=0,m=1,x=2;
if(! n)x-=1;
if(m) x-=2;
if(x) x-=3;
printf("%d/n",x);
}
执行后的输出结果是{{U}} 【10】 {{/U}}。
填空题下列语句的输出结果是{{U}} 【11】 {{/U}}。
char a=3;printf("%d,%o,%x,%u/n",a,a,a,a);
填空题以下函数creat用来建立一个带头结点的单向链表,新产生的结点总是插在链表的末尾,单向链表的头指针作为函数值返回。请填空。
#include<stdio.h>
#include<stdlib.h>
struct list
{ char data;
struct list*next;
};
struct list*creat()
{ struct list*h, *p, *q;
char ch;
h=______ malloc (sizeof(______));
p=q=h;
ch=getchar();
while(ch!='?')
{ p=______ malloc (sizeof (______));
p->data=ch; q->next=p; q=p;
ch=getchai();
}
p->next='/0';
______;
}
填空题若由以下定义,则不移动指针p,且通过指针p引用值为98的数组元素的表达式是{{U}} 【6】 {{/U}}。
int w[10]={23,54,10,33,47,98,72,80,61},*p=w;
填空题设Y是int型变量,请写出判断Y为奇数的关系表达式 【6】 。
填空题以下程序的输出结果为 【13】 。 #define JFT(x)x*x main() int a, k=3; a =++ JFT(k+1); printf("%d",a);
填空题以下程序运行后输出的结果是 【9】 。 main() int x=1,y=0,a=0,b=0; switch(x) case 1:switch(y) case 0:a++;break; case 1:b++;break; case 2:a++;b++;break; printf("%d%d/n",a,b) ;
填空题若有如下程序: main() int a[][2]=1,2,6,9,11,(*t)[2]; t=a; printf("%d,%d/n",*(t[1]+1), (*t) [1]); 则程序运行后输出的结果是 【20】 。
填空题下面程序的输出结果是 【12】 。 char b[]="ABCD"; main() char *p=b; for(;*p;p++) printf("%s",p); printf("/n");
填空题实现算法所需的存储单元多少和算法的工作量大小分别称为为算法的{{U}} 【1】 {{/U}}。
填空题以下程序的运行结果是 {{U}} 【19】 {{/U}}
#include <string.h>
typedef struct student{
char name[10];
long sno;
float score; }STU;
main( )
{ STU a={“zhangsan”,2001,95},b={“Shangxian”,2002,90},
c={“Anhua”,2003,95},d,*p=
d=a;
if(strcmp(a.name,b.name)>0) d=b;
if(strcmp(c.name,d.name)>0) d=c;
printf(“%ld%s/n”,d.sno,p->name);
