首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> #define N 4 void fun(int a[][N]) { int b[N][N],i,j; for(i=0; i<N; i++) for(j=0; j<N; j+
有以下程序 #include <stdio.h> #define N 4 void fun(int a[][N]) { int b[N][N],i,j; for(i=0; i<N; i++) for(j=0; j<N; j+
admin
2021-02-25
14
问题
有以下程序
#include <stdio.h>
#define N 4
void fun(int a[][N])
{ int b[N][N],i,j;
for(i=0; i<N; i++)
for(j=0; j<N; j++)
b
[j] = a[N-1-j]
;
for(i=0; i<N; i++)
for(j=0; j<N; j++)
a
[j] = b
[j];
}
main()
{ int x[N][N]={ {1, 2, 3, 4},
{5, 6, 7, 8},
{9,10,11,12},
{13,14,15,16}}, i;
fun(x);
for (i=0;i<N; i++)
printf("%d,", x
);
printf("\n");
}
程序的运行结果是
选项
A、13,10,7,4,
B、1,6,11,16,
C、4,7,10,13,
D、1,5,9,13,
答案
A
解析
函数调用中,将数组名作为参数,将数组地址传给形参,所以函数中对数组a的操作将会改变x数组元素值。函数实现将原数组列变成行,再将每一行首尾倒置,此时数组a(也即x)中元素为{{13,9,5,1},{14,10,6,2},{15,11,7,3},{16,12,8,4}},则输出13,10,7,4,A选项正确。
转载请注明原文地址:https://kaotiyun.com/show/VBtp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下程序的输出结果是()。structSTR{intn;inta[20];};voidf(structSTR*p){inti,j,t;for(i=0;i一1;i++)for(j=i+1;jn;j++)if(p一>a[i]>p一>
合法的C语言数据常量是()。
C语言程序中,运算对象必须是整型数的运算符是
若有以下程序#includemain(){inta=6,b=0,c=0;for(;a;){b+=a;a-=++c;}printf("%d,%d,%d\n",a,b,c);}则程序的输出结果是
有以下定义:inta:longb:doublex,y;则以下选项中正确的表达式是
以下正确的字符串常量是
下列给定程序中,函数fun的功能是:用选择法对数组中的n个元素进行升序排列。请修改程序中的错误,使它能得出正确的结果。注意:不得增行和删行,也不得更改程序的结构!试题程序:#include<stdio.h>#defineN20
下列方法中,属于白盒法设计测试用例的方法的是()。
有三个关系R,S和T如下图所示:则由关系R和S得到关系T的运算是
在下列模式中,能够给出数据库物理存储结构与物理存取方法的是()。
随机试题
美国小学的教学组织,分为纵向组织和横向组织。下列属于纵向组织的是()
在Excel中,在工作表Sheet3引用工作表Sheet2中的A6单元格,应采用下列()表示方式。
导致成年人缺铁最常见的原因是
术后胃肠减压,拔胃管的时机是
下列哪项容易引起泌尿系感染
信用是经济活动中的借贷行为,其本质包括()。[2005年考试真题]
下题是某教师编写的,用于考查“探究通电螺线管外部磁场的方向”的试题,命题者希望考查的探究要素是“进行实验和收集数据”。学生在“探究通电螺线管外部磁场的方向”实验中,经历了分析、判断小磁针指向跟磁感线的关系的过程,试题的编写意图就是考查这一关系。
关于供电可靠性,下列说法正确的是()。
下列是一台第三层交换机的部分路由表,其中管理距离为缺省值,正确的路由信息是()。
我们的生活如此依赖各种交通工具,以至于我们无法想象没有交通工具我们的生活会怎样。
最新回复
(
0
)