首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include main() {int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:"); printf("%d\n",p); } 该程序试图通过指
有以下程序 #include main() {int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:"); printf("%d\n",p); } 该程序试图通过指
admin
2019-06-09
26
问题
有以下程序
#include
main()
{int n,*p=NULL;
*p=&n;
printf("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/73Rp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列叙述中,正确的是()。
设Y为整型变量,A=1,A的地址为EF01;B=2,B的地址为EF02;执行语句B=&A:Y=&B;后Y的值()。
若有以下程序#includemain(){inti,j=0;chara[]="Howareyou!",b[10];for(i=0;a[i];i++)if(a[i]==’’)b[j++]=a[i+1];b[
有以下程序#includemain(){inta=0,b=0,c=0,d=0;(a++&&b++)?c++:d++;printf("%d,%d,%d,%d\n",a,b,c,d);}程序的运行结果是()。
若有定义 inta,b,c;以下选项中的赋值语句正确的是()。
C语言中的标识符分为关键字、预定义标识符和用户标识符,以下叙述正确的是()。
设有函数定义:voidsub(intk,charch){…}则以下对函数sub的调用语句中,正确的是()。
下列关于C语言文件的叙述中正确的是()。
以下选项中不属于C语言标识符的是
随机试题
齿衄之阴虚火旺证的选方是
在规定的释放介质中缓慢地恒速释放药物的胶囊剂是()。
责任原理包含()。伦迪公司在哪些方面做得不周到()。
按照《建筑地基基础设计规范》(GB50007—2002),当基础宽度大于3m或埋置深度大于0.5m时,下列情况中需对地基承载力特征值进行修正的是()。
A厂委托B厂加工一批应税消费品(化妆品),A厂提供的原材料成本为54000元,B厂收取(不舍税)加工费9000元,该应税消费品适用税率为30%,受托的B厂没有同类消费品的销售价格。A厂将委托加工的已税消费品收回后,领用一半用于继续生产最终应税消费品(高档化
某项目现有三个互斥的投资方案A、B、C,欲从中选择最有利的方案,三个投资方案的投资额及一年后的净收益如下表所示。各方案的寿命期都是一年,一年后的净残值为零。假设基准收益率为6%。根据题意,回答下列问题:【2008年真题】C方案的净现值为(
音乐的各种样式和类别叫作_________。
下面关于变形链球菌的叙述正确的有()。
VLAN在现代组网技术中占有重要地位。在由多个VLAN组成的一个局域网中,以下哪种说法不正确?()
A、Avisittoseveralcoffee-growingplantations.B、Coffeepricesandhisadvertisingcampaign.C、Avacationonsomebeautifultr
最新回复
(
0
)