填空题
以下程序运行后的输出结果是【 】
main( )
{ int i,j,a[ ][3]={1,2,3,4,5,6,7,8,9};
for(i=0;i<3;i++)
for(j=i+1;j<3;j++) a[j][i]=0;
for(i=0;i<3;i++)
{ for(j=0;j<3;j++) printf("%d ",a[i][j]);
printf("\n");
}
}
【参考答案】
1 2 3
0 5 6
0 0 9
热门
试题
填空题
下列程序中函数fun的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空。#include <stdio.h>#define N 3typedef struct{ int num; char nam[10]; char sex;} SS;int fun(SS person[]){ int i,n=0;for(i=0; i<N; i++)if( 【 】 ==’’M’’) n++;return n;}main(){ SS W[N]={{1, AA ,’’F’’},{2, BB ,’’M’’},{3, CC ,’’M’’}}; int n;n=fun(W); printf( n=%d n , n);}