首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include main() {int n,*p=NULL; *p=&n; pr*ntf("Input n:"); scanf("%d",&p); printf("output n:
有以下程序 #include main() {int n,*p=NULL; *p=&n; pr*ntf("Input n:"); scanf("%d",&p); printf("output n:
admin
2019-12-17
26
问题
有以下程序
#include
main()
{int n,*p=NULL;
*p=&n;
pr*ntf("Input n:");
scanf("%d",&p); printf("output
n: ");
printf("%d\n",p);
}
该程序试图通过指针P为变量n读入数据并输出,但程序有多处错误,以下语句正确的是
选项
A、int n,*p=NULL;
B、*p=&n;
C、scanf(“%d”,&p)
D、printf(“%d\n",p);
答案
A
解析
选项A)表示在程序中,声明定义变最语句“int n,*p=NULL;”定义了整型变量n和指针变量p,并且指针变量p初始化为空。其他的语句都是错误的。其中选项B),&n的地址应存放到指针变量p中,而选项C)中数据输入项错误.选项D)输出地址信息。
转载请注明原文地址:https://kaotiyun.com/show/ZQCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
C语言源程序名的后缀是
若有以下定义intx[10],*pt=x;则对x数组元素的正确引用是
下列关于C语言文件的叙述中正确的是
以下叙述中正确的是
以下结构体类型说明和变量定义中正确的是
以下选项中关于C语言常量的叙述错误的是
在主函数中从键盘输入若干个数放入数组中,用0结束输入并放在最后一个元素中。下列给定程序中,函数fun的功能是:计算数组元素中所有值为正数的平均值(不包括0)。例如,数组中元素的值依次为:39、一47、21、2、一8、15、0,则程序的运行结果为19.25
程序通过定义学生结构体变量,存储了学生的学号、姓名和三门课的成绩。所有学生数据均以二进制方式输出到文件中。函数fun的功能是重写形参filename所指文件中最后一个学生的数据,即用新的学生数据覆盖该学生原来的数据,其他学生的数据不变。请在程序的下画线处
下列选项中不属于面向对象程序设计特征的是
设序列长度为n,在最坏情况下,时间复杂度为O(10g2n)的算法是()。
随机试题
在《叶甫盖尼.奥涅金》中,爱上主人公奥涅金,但遭其拒绝的人物是()
在设计评审中,中期评审的内容包括_____、_____、_____。
目前最常用的最有效的引产方法是
《宪法》第93条规定,中华人民共和国中央军事委员会领导全国武装力量。下列关于国家军事委员会的说法中,正确的是哪一项?()
()使投资组合中债券的到期期限集中于收益曲线的一点。
弗洛伊德认为,心理健康发展的充分必要条件是()。
甲欲杀乙,某日携带炸药前往乙家要炸死乙,乙刚好出差不在家。甲蹲守一夜后未见乙归,就没有将乙家炸毁。甲的行为构成()
在全球各地,很多地方都面临着干旱带来的灾害,而人们常常对这些灾害不知所措。近日,一些科学家们发现了一种激光。发射后能够在空气中制造水滴,使阴云增加水汽并带来降雨。他们认为这将会帮助人们决定降雨量和时间,并取代传统的人工降雨方法。以下哪项如果为真,
[*]
Everyoneknowsthattoomuchtimeinthesuncanexposeyoutoexcessiveultravioletradiation,whichcanleadtoskincancers.【
最新回复
(
0
)