首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有如下程序: #include using namespace std; int main() {int*p; *p=9; cout
有如下程序: #include using namespace std; int main() {int*p; *p=9; cout
admin
2020-06-29
9
问题
有如下程序:
#include
using namespace std;
int main()
{int*p;
*p=9;
cout<<"The value at p:"<<*p;
return 0:
}
编译运行程序将出现的情况是( )。
选项
A、编译时出现语法错误,不能生成可执行文件
B、运行时一定输出:The value at p:9
C、运行时一定输出:The value at p:*9
D、运行时有可能出错
答案
D
解析
题目程序中“int*p;”是定义了一个指针变量p,“*p=9;”是将p当前指向的指针赋为9。指针p在执行这个赋值操作前并没有初始化这个变量p,所以会有p未初始化的警告错误。
转载请注明原文地址:https://jikaoti.com/ti/muA0FFFM
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
下列程序的执行结果为【 】。#inciude<iostream,h>intf(inti){return++i;}intg(int&i){return++i;}voidmain(){inta,b;a=
若有以下程序:#include〈iostream〉usingnamespacestd;intmain(){intdata[4],i,j,temp;for(i=O;i>data[i];
A、 B、 C、 D、 D栈是一种特殊的线性表,栈是限定在表的一端进行插入和删除运算的线性表。
C++中的数据类型大体上可以分成三类:它们是______、______和______。
下面程序的结果为#include<iostream.h>intc;classA{private:inta;static
可以用p.a的形式访问派生类对象p的基类成员a,其中a是
若磁盘上已存在某个文本文件,其全路径文件名为d:\ncre\test.txt,下列语句中不能打开该文件的是
在数据库设计中,将E-R图转换为关系模式的过程属于()。
数据字典是数据库设计需求分析阶段的重要工具之一,其最基本的方法是()
在E-R图中,用来表示实体联系的图形是( )。
随机试题
许多国家在制定政策过程中实行的听证制度的核心要求是()
ByfarthemostcommonsnakeinBritainistheadder.InScotland,infact,therearenoothersnakesatall.Theadderisalso
关于咽的淋巴组织,下列说法不正确的是
女,23岁。G0P0。右下腹隐痛半个月,加重5小时。平素月经不规律。查体:T37.0℃,P96次/分,R23次/分,BP105/75mmHg。妇科检查:子宫右旁可触及大小约6cm的实性包块,触痛,子宫及左侧附件未触及异常。血清AFP900μg/L。
根据《建设工程施工合同(示范文本)》,承包人提供质量保证金的方式原则上应为()。
地基处理中的灌浆按其目的可分为固结灌浆,帷幕灌浆和()等。
“合同中的权利义务对等”“合同当事人必须就合同条款充分协商,取得一致,合同才能成立”这体现了《中华人民共和国合同法》的()。
A.inappropriateB.attendC.slipsD.trackE.financeF.unchangeableG.organizeH.participateI.formalJ.asmuchasK.sl
Since,wearetold,80to90percentofallinstructioninthetypicaluniversityisbythelecturemethod,weshouldgiveclose
EveryyearinthefirstweekofmyEnglishclass,somestudentsinformmethatwritingistoohard.Theyneverwrite,unlessass
最新回复
(
0
)