首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序的运算结果为 ( )。 #include < iostream > using namespace ~td; int i; int fun( ) { static int i = 10; return + + i;
下面程序的运算结果为 ( )。 #include < iostream > using namespace ~td; int i; int fun( ) { static int i = 10; return + + i;
admin
2013-02-27
63
问题
下面程序的运算结果为 ( )。 #include < iostream > using namespace ~td; int i; int fun( ) { static int i = 10; return + + i; void main ( ) { fun( ); cout <<fun() <<" ," <<i; }
选项
A、10,100
B、12,100
C、12,12
D、11,100
答案
2
解析
fun()中的i为静态变量只在函数中可见,执行两次变为12;主函数中的i为全局变量,fun()对i的修改不影响。
转载请注明原文地址:https://kaotiyun.com/show/evVp777K
本试题收录于:
二级C题库NCRE全国计算机二级分类
0
二级C
NCRE全国计算机二级
相关试题推荐
深度为7的二叉树共有127个节点,则下列说法中错误的是()。
某完全二叉树共有256个节点,则该完全二叉树的深度为()。
下列叙述中正确的是()。
若变量已经定义且正确赋值,则针对程序段:temp=a;a=b;b=temp;以下叙述中正确的是()。
以下是正确C语言实型常量的是()。
标准库函数fgets(str,n,fp)的功能是()。
以下不能定义为用户标识符的是()。
在最坏情况下比较次数相同的是()。
如图所示:带有头结点的单向链表head,其三个数据结点A、B、C的连接关系如下图所示: 结点类型的定义为: structlink { doubledt; structlink*next; }; 若指针p指向A结点,
随机试题
能治疗瘿瘤的药物有( )
猪,45日龄,做去势术,按照常规方法摘除睾丸后,处理切口的方式为
最美观的修复体是固位力最差的是
在下列各类市场中,属于生产要素市场的有()。
TheconceptcapturedtheZeitgeistofthepersonalcomputerrevolution.Manyyoungpeople,especiallythoseinthecountercultur
A=AudiA3B=HondaCivicC=Rover200D=ToyotaCamryHybridWhichcar...hasadriverseatthatcanbeadjustedtofitmo
Americansaregettingreadyforthebiggestsoccereventintheworld.Forthefirsttimetheworldcupsoccercompetitionwill
Wouldyouliketoknowifyourbodyisolderoryoungerthanitshouldbe?DrDavidWikenheiserhasbeenstudyingageinginVanc
ThecreationofUNwas,perhaps,themost______achievementofthe20thcentury.
Manyconsumeritemsarebeingredesignedaccordingtothenewstandardwhowillminimizetheirenvironmentalimpact.
最新回复
(
0
)