首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include<stdio.h> main() {int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:"); printf("%d\n",p);}
有以下程序 #include<stdio.h> main() {int n,*p=NULL; *p=&n; printf("Input n:");scanf("%d",&p);printf("output n:"); printf("%d\n",p);}
admin
2016-12-18
22
问题
有以下程序
#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/G8Dp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
可在C程序中用作用户标识符的一组标识符是
下列选项中,不属于模块间耦合的是
有如下程序inta[10]={1,2,3,4,5,6,7,8,9,10};int*p=&a[3],b;b=p[5];则b的值是
表示关系a≤b≤c的C语言表达式为()。
以下程序的功能是:借助指针变量找出数组元素中最大值所在的位置并输出该最大值。请在输出语句中填写代表最大值的输出项。#includemain(){inta[10],*p,*S;for(p=a;p-a
有以下程序#includemain(){intn[2l,ij;for(i=0;i
数据库设计分为以下6个设计阶段:需求分析阶段、【】、逻辑设计阶段、物理设计阶段、实施阶段、运行和维护阶段。
下面程序段的输出为#include"stdio.h"main(){printf("%d\n",12
对于下述程序,在方式串分别采用“wt”和“wb”运行时,两次生成的文件TEST的长度分别是#include<stdio.h>voidmain(){FILE*fp=fopen("TEST",);fputc(’A’,fp
现有两个C程序文件T18.c和myfun.c同在TC系统目录(文件夹)下,其中T18.c文件如下:#include<stdio.h>#include"myfun.c"maim(){fun();printf("\n");}myfun.c文件如下:
随机试题
ACD保养液保存血液的有效天数是
A.鼻泪管不全阻塞或狭窄B.泪总管阻塞C.鼻泪管阻塞合并慢性泪囊炎D.泪小管阻塞E.功能性泪溢
导致阻塞性肺气肿和慢性肺源性心脏病占第一位的病因是
患者临床诊断最大可能是其治疗方法目前首选
A.不小于150平方米B.不小于100平方米C.不小于50平方米D.不小于40平方米E.不小于30平方米大型零售企业营业场所的面积()
预算必须与企业的战略或目标保持一致,这是预算最主要的特征。()
本题涉及增值税法、税收征收管理法。大华机械公司为增值税一般纳税人,主要生产各种电动工具。2014年7月10日该公司申报缴纳6月份增值税税款100万元。7月底,税务机关对该公司6月份增值税计算缴纳情况进行专项检查,有关检查情况如下:(1)6月2日收到代销
下列控制活动中,属于检查性控制的有()。
正方体ABCD-A’B’C’D’中,侧面对角线AC与BC’所成的角等于()。
Futurologistshavenotbeenverypreciseabouthowandhowmuchdigitalmediawillchangeourlives.Mostofcommentshavefocus
最新回复
(
0
)