首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> #include <stdlib.h> void fun( int *p1, int *p2, int *s) { s=( int*)calloc(1,sizeo
有以下程序 #include <stdio.h> #include <stdlib.h> void fun( int *p1, int *p2, int *s) { s=( int*)calloc(1,sizeo
admin
2020-06-16
23
问题
有以下程序
#include <stdio.h>
#include <stdlib.h>
void fun( int *p1, int *p2, int *s)
{ s=( int*)calloc(1,sizeof(int));
*s=*p1+*p2;
free(s);
}
main()
{ int a[2]={1,2}, b[2]={40,50},*q=a;
fun(a,b,q);
printf("%d\n", *q);
}
程序运行后的输出结果是
选项
A、42
B、41
C、1
D、0
答案
C
解析
本题考查把数组名作为函数参数,执行fun函数后,s的值并没有发生变化,仍然是指向a,所以输出结果为1,选项C正确。
转载请注明原文地址:https://kaotiyun.com/show/WZCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序:#include<stdio.h>#include<string.h>structS{charname[10];};voidchange(structS*data,intvalue){
有以下程序:#include<stdio.h>main(){inta=一1,b=一1;for(;++a;)++b;printf("%d%d\n",a,b);}程序运行后的输出结果是(
以下叙述中正确的是()。
设有定义:intx=2;,则以下表达式中,值不为6的是()。
有以下程序(注意:字母A的ASCII码值为65):#include<stdio.h>main(){char*s={"ABC"};do{printf("%d",*s%10);}while(*s++);
设有定义:chars[81];inti=0;,以下不能将一行(不超过80个字符)带有空格的字符串正确读入的语句或语句组是()。
数据库应用系统中的核心问题是()。
算法的空间复杂度是指()。
下列选项中不属于结构化程序设计原则的是()。
以下不能将s所指字符串正确复制到t所指存储空间的是()。
随机试题
常用的网络数据加密方式有链路加密、节点加密和____________。
1937年,在淞沪会战中率领“八百壮士”孤军据守四行仓库的爱国将领是()
若φ(x)=∫0xtan2tdt,则φ’(x)=_______.
下列关于帕金森病患者步态训练,内容不正确的是
做结核菌素试验,注射后多长时间看结果
甲公司2016年实现净利润500万元。当年发生的下列交易或事项中,影响其年初未分配利润的是()。
某公司办公大楼原值30000万元,2014年2月28日将其中部分闲置房间出租,租期2年。出租部分房产原值5000万元,租金每年1000万元。当地规定房产税原值减除比例为20%,2014年该公司应缴纳房产税()。
旅行社为散客提供的旅游服务类型不包括()。
四岁的磊磊在画画时,常常画一棵树,突然想起什么,又开始画一把剑,等会又画小鸭、蛋糕等,这说明磊磊()
行政诉讼中,人民法院审理行政案件,可以参照()。
最新回复
(
0
)