首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #include void fun( int *p1, int *p2, int *s) { s=( int*)calloc(1,sizeof(int)); *s=*p1+*p2; free(s); } main()
有以下程序 #include #include void fun( int *p1, int *p2, int *s) { s=( int*)calloc(1,sizeof(int)); *s=*p1+*p2; free(s); } main()
admin
2019-06-09
23
问题
有以下程序
#include
#include
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/AxRp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下关于结构化程序设计的叙述中正确的是
对于一个正常运行的C程序,以下叙述中正确的是
若有以下程序#include<stdio.h>main(){inta=1,b=2,c=3,d=4;if((a=2)&&(b=1))c=2;if((c=3)‖(d=-1))a=5;printf(’’%d,%d,%d,%d\n’’,a,b,
以下叙述中正确的是
设有定义:intx[2][3];则以下关于二维数组x的叙述错误的是
以下叙述中正确的是
以下叙述中正确的是
以下叙述中正确的是
若函数调用时的实参为变量时,以下关于函数形参和实参的叙述中正确的是
以下选项中叙述错误的是
随机试题
认识的本质是【】
公路隧道土建结构专项检查中材质检查项目有()。
有关质量管理体系文件的阐述,正确的包括( )。
根据施工许可制度的要求,建设项目因故停工,( )应当自中止施工之日起1个月内向发证机关报告。
对国家机关、国有金融机构、国有企业事业单位进行监督的单位()
汇票转让只能采用背书的方式,而不能仅凭单纯交付方式。()
长期股权投资在成本法核算下,只要被投资单位宣告现金股利就应确认投资收益。()
Somedoctorsaretakinganunusualnewapproachtocommunicatebetterwithpatients—theyareletting【C1】________readthenotest
Howmanyoldpeoplehavebeenexaminedfortheresearch?
WhydothewomenprofessionalfootballersinSpainholdastrike?
最新回复
(
0
)