首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> int k=5; void f(int *s) { s=&k; *s=7; } main( ) { int m=3; f(&m); printf("%d,%d\n"
有以下程序 #include <stdio.h> int k=5; void f(int *s) { s=&k; *s=7; } main( ) { int m=3; f(&m); printf("%d,%d\n"
admin
2021-07-09
24
问题
有以下程序
#include <stdio.h>
int k=5;
void f(int *s)
{ s=&k;
*s=7;
}
main( )
{ int m=3;
f(&m);
printf("%d,%d\n", m, k);
}
程序运行后的输出结果是
选项
A、3,5
B、7,7
C、5,7
D、3,7
答案
D
解析
函数f()的功能是定义一个整型的指针变量s,指向全局变量k,然后修改s指向地址中的值为7,因此f()函数只是修改全局变量k的值为7,与main()函数中临时变量m无关,因此最后输出为3,7,答案为D选项。
转载请注明原文地址:https://kaotiyun.com/show/7ltp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下叙述中正确的是
有以下程序段inti,n;for(i=0;i<8;i++){n=rand()%5;switch(n){case1:case3:printf("%d\n",n);break;case2:case4:printf("%d\n",n);cont
有以下程序voidswap(char*x,char*y){chart;t=*x;*x=*y;*y=t;}main(){char*s1="abc",*s2="123";swap
以下选项中能表示合法常量的是
下列关于return语句的叙述中正确的是()。
有以下程序#includemain(){inta=7;while(a--);printf(“%d\n”,a);}程序运行后的输出结果是
若有定义语句charc=’\101’;则变量C在内存中占
以下定义语句中正确的是
某系统总体结构如下图所示,该系统结构图的宽度是
随机试题
菌落总数是在规定的条件下培养检样所得的计数,具体指
A.一期梅毒 B.二期梅毒 C.三期梅毒 D.隐性梅毒 E.先天性梅毒主要表现为杨梅疮的是
A.聚氧乙烯脱水山梨醇脂肪酸酯B.苯扎氯铵(洁尔灭)C.卵磷脂D.磺酸化物E.苯甲酸类非离子型表面活性剂是()。
在国家权力结构中,行政权力主要包括()。
某产品由3道工序加工而成,原材料在每道工序中陆续投入,各工序的材料消耗定额分别为70千克、30千克和50千克,用约当产量法分配原材料费用时,下列选项中,正确的有()。
()发表《天体运行论》,确立了日心说,成为近代天文学的起点。
WhatIstheCoolestGasintheUniverse?WhatisthecoldestairtemperatureeverrecordedontheEarth?Wherewasthislow
A、TheGermanteam.B、TheBritishteam.C、TheBrazilianTeam.D、TheAmericanteam.CWhatteamwilltheCubansplaytomorrow?
Whatoursocietysuffersfrommosttodayistheabsenceofconsensusaboutwhatitandlifeinitoughttobe.Suchconsensusca
WhenMomandDadGrowOldA)Theprospectoftalkingtoincreasinglyfragileparentsabouttheirfuturecanbe"oneofthemostd
最新回复
(
0
)