首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include<stdio.h> main() {int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:"
有以下程序 #include<stdio.h> main() {int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:"
admin
2017-04-26
26
问题
有以下程序
#include<stdio.h>
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/WSDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
设有下列程序:#include<stdio.h>#include<string.h>main(){inti;chars[10],t[10];gets(t);for(i=0;i<2;i++){gets(s);if(strcmp
变量a中的数据用二进制表示的形式是01011101,变量b中的数据用二进制表示的形式是11110000。若要求将a的高4位取反,低4位不变,所要执行的运算是
有如下程序main(){charch[2][5]={"6937","8254"},*p[2];inti,j,s=0;for(i=0;i<2;++)p[i]=ch[i];for(i=0;i<2;i++)
有以下程序#include<stdio.h>main(){intx=1,y=0,a=0,b=0;switch(X){case1:switch(y){case0:a++;
若变量已正确定义,有以下程序段inta=3,b=5,c=7;if(a>B)a=b;c=a;if(c!=A)c=b;printf("%d,%d,%d\n",a,b,c);其输出结果是
下列的for语句的循环次数为______。for(x=1,y=0;(y!=19)&&(x<7);x++);
设有下列说明语句:strcutstr{intx;floaty;charz;}st;则下列的叙述中不正确的是()。
在执行完下列的C语句段之后,则B的值是()。Chara="A";intb;B=((34&&56)&&(a<’b’));
随机试题
领导类型的划分是()
患者,女性,37岁,已婚,1-0-3-1,因“放宫内节育器6年,近1年经期延长至10余天”就诊。该患者进一步的检查应选择[病史询问结果]患者6年前在乡计划生育指导站人工流产时放置T型宫内节育器,经过顺利;术后每年1次随访,但近2年因外出打
下列药物在使用前需要做过敏试验的是
某企业上年12月31日资产负债表部分项目的年初数和期末数如表7—3所示。(单位:元)该企业上年度产品销售收入4000000元,利润总额400000元,应交所得税100000元,利息支出15000元。本年1月份发生的部分经济业务如下:(
在对客户的资金调用和调整成本方面,理财师应把握好的原则有()。
甲企业为增值税一般纳税人,适用的增值税税率为17%,存货采用计划成本法核算。该企业2010年9月初“应交税费”账户余额为零,当月发生下列相关业务:(1)购入材料一批,价款200000元,增值税税额34000元,以银行存款支付,该材料计划成本210000元
职工基于企业组织一员的身份而得到的,与职工个人的工作绩效无直接关系的是()。
李安新片《少年派的奇幻漂流》,再度引发观影热潮。短短十几天之内.几乎每一位评论家都在谈论导演想象的奇谲,每一位观众都在解读影片背后的玄妙深意。应该说.优秀的作品为受众提供了开放的读解空间,而受众的解读也为文艺作品的阐释提供了丰富的认知可能。然而,值得警惕的
参加阅兵式的官兵排成一个方阵,最外层的人数是80人,这个方阵共有官兵多少人?()
Madewasatall,handsome22-year-oldBalinesemanwhowasinlovewithonegirlbutexpectedtomarryanother.Hisstepmotherh
最新回复
(
0
)