填空题有以下程序:
main()
{ int a=7,b=8,*p,*q,*r;
p= q=
r=p; p=q; q=r;
printf("%d,%d,%d,%d/n",*p,*q,a,b);
}
程序运行后的输出结果是{{U}} 【5】 {{/U}}。
填空题下列程序的运行结果是{{U}} 【10】 {{/U}}。
#include <stdio.h>
main()
{ union EXAMPLE
{ struct
{ int x; int y;} in;
int a;
int b;
}e;
e.a=1;e.b=2;
e.in.x=e.a*e.b;
e.in.y=e.a+e.b;
printf("%d,%d/n",e.in.x,e.in.y);
}
填空题以下程序运行后的输出结果是______。 main() int a[4][4]=1,2,3,4),5,6,7,8,11,12,13,14,15,16,17,18; int i=0,j=0,s=0; while (i++<4) if (i==2 || i==4)continue; j=0; do S+= a[i][j] ;j++; while (j<4); printf("%d/n",s);
填空题给定程序中,函数fun的作用是:不断从终端读入整数,由变量a统计大于0的个数,用变量c来统计小于0的个数,当输入0时结束输入,并通过形参pa和pb把统计的数据传回主函数进行输出。
请在程序的下画线处填入正确的内容并把下画线删除,使程序得出正确的结果。
注意:不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
void fun(int*px,int*py)
{
/**********found**********/
int ______;
scanf("%d",
/**********found**********/
while ______
{if(k>0)a++;
if(k<0)b++;
/**********found**********/
______;
}
*px=a;*py=b;
}
main()
{int x,y;
fun(
printf("x=%d y=%d/n",x,y);
填空题以下程序的输出结果是{{U}} 【11】 {{/U}}。
# define MCNA(m)2*m
# define MCNB(n, m)2*MCRA(n)+m
# define f(x)(x*x)
main()
{ int i=2, j=3;
printf("% d/n", MCRB(j, MCRA(i)));
}
填空题以下程序的功能是:求出数组x中各相邻两个元素的和依次存放到a数组中,然后输出。请填空。 main( ) int x[10],a[9],i; for(i=0;i<10;i++) scanf("%d",&x[i]); for( [11] ;i<10;i++) a[i-1]=x[i]+ [12] ; for(i=0;i<9;i++) printf("%d",a[i]); printf("");
填空题有如下图所示的双链表结构,请根据图示完成结构体的定义:structaa{intdata;{{U}}【15】{{/U}}}node;
填空题程序的功能是将文件filel.c的内容输出到屏幕上并复制到文件file2.c中,请填空。
#include<stdio.h>
main()
{ FILE {{U}}【19】 {{/U}};
fp1=fopen("filel.c","r");
fp2=fopen("file2.c","w");
while(!feof(fp1)) putchar(getc(fp1));
rewind(fp1);
while(!feof(fp1)) putc({{U}} 【20】 {{/U}});
fclose(fp1);
fclose(fp2);
}
填空题int *p 的含义是___________________________________________。
填空题以下程序用业统计文件十字符个数。请填空。 #include "stdio.h" main() FTLE *fp; long num=OL; if((fp=fopen("fname.dat","r"))==NUlL) pirntf("Open error/n"); exit(0); while( ) fgetc(fp); num++; printf("num=%1d/n",num-1); fclose(fp);
填空题以下程序运行后的输出结果是______。
#include<string.h>
#include<stdio.h>
main()
{ char s[20]="goodgood!", *sp=s;
sp=sp+2; sp="to"; puts(s);
}
填空题下面程序的运行结果是: 【19】 。 typedef union student char name[10]; long sno; char sex; float score[4]; STU; main() STU a[5]; Printf(“%d/n”,sizeof(a));
填空题下列给定程序中,函数fun()的功能是:在带头结点的单向链表中,查找数据域中值为ch的结点。找到后通过函数值返回该结点在链表中所处的顺序号;若不存在值为ch的结点,函数返回0值。
请在标号处填入正确的内容,使程序得出正确的结果。 注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构。
试题程序 #include
<stdio.h> #include <stdlib.h> #define N
8 typedef struct list { int data;
struct list *next; } SLIST; SLIST
*creatlist(char *); void outlist(SLIST *); int
fun( SLIST *h, char ch) { SLIST *p; int n=0;
p=h->next; while(p!=______) { n++;
if(p->data==ch) return______; else p=p->next;
} return 0; }
main() { SLIST *head; int k; char ch; char
a[N]={'m', 'p', 'g', 'a', 'w', 'x', 'r', 'd'};
head=creatlist(a); outlist(head);
printf("Enter a letter:"); scanf("% c",
k=fun(______); if(k==0) printf("/nNot found!
/n"); else printf("The sequence number is:%
d/n", k); } SLIST *creatlist(char
*a) { SLIST *h, *p, *q; int i; h=p=(SLIST *)
malloc (sizeof(SLIST)); for(i=0; i<N; i++) {
q=(SLIST *) malloc (sizeof(SLIST)); q->data=a[i]; p->next=q;
p=q; } p->next=0; return
h; } void outlist(SLIST *h) {
SLIST *p; p=h->next; if(p==NULL)
printf("/nThe list is NULL! /n"); else
{ printf("/nHead"); do { printf("->%
c", p->data); p=p->next; }
while(p!=NULL); printf("->End/n"); }
}
填空题以下程序的功能是输入任意整数给n后,输出n行从大写字母A开始构成的三角形字符阵列图形。例如,输入整数5时(注意:n不得大于10),程序运行结果如下: A B C D E F C H I J K L M N O 请填空完成该程序。 #include <stdio.h> main( ) int i.j,n;char ch ='A'; scanf(" % d" , if( n<11 ) for(i=1; i<=n;i++) for(j =1; j< =n-i+1;j++) printf( "%2c" ,ch); 【6】 ; 【7】 ; else printf ("n is too large! /n" ); prinff("/n");
填空题已知存储结构如下所示,请填空。datanextstructlinkchardata;【18】;node;
填空题下面程序的运行结果是{{U}} 【10】 {{/U}}。
main()
{ int i=0,j=10,k=2,s=0;
for(;;)
{ i+=k;
if(i>j)
{ printf("%d/n",s);
break;}
s+=i; } }
填空题下列给定程序中函数fun的功能是:判断一个整数是否为素数,若是素数返回1,否则返回0。
在main函数中,若fun返回1输出YES,若fun返回0输出NO!。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stctlib.h>
#include<conio.h>
#include<stdio.h>
int fun(int m)
{
int k=2;
while(k<=m
else return 0;
}
void main()
{
int n;
system("CLS");
printf("/nplease enter n:");
scanf("%d",
if(fun(n))printf("YES/n");
else printf("NO!/n");
}
填空题有以下程序
main()
{ char a,b,C,d;
scanf("%c,%c,%d,%d”,&a,&b,&c,&d);
printf("%c,%c,%c,%c/n "a,b,c,d);
}
若运行时从键盘上输入:6,5,65,66<回车>。则输出结果是______。
填空题在C语言中,while和do…while循环的主要区别是______的循环至少被执行一次。
填空题有以下说明定义和语句,可用a.day引用结构体成员day,写出引用结构体成员day的其他两种形式 【16】 、 【17】 。 struct int day;char mouth;int year;a,*b;b=&a;
