首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> void func( int n ) { static int num = 1; num += n; printf("%d ", num); } main() {
有以下程序 #include <stdio.h> void func( int n ) { static int num = 1; num += n; printf("%d ", num); } main() {
admin
2021-02-25
12
问题
有以下程序
#include <stdio.h>
void func( int n )
{
static int num = 1;
num += n;
printf("%d ", num);
}
main()
{
func(3);
func(4);
printf("\n");
}
程序运行后的输出是
选项
A、4 5
B、4 8
C、3 5
D、3 4
答案
B
解析
本题中num为静态局部变量,执行fun(3)后,输出4,执行fun(4)后输出8,所以选项B正确。
转载请注明原文地址:https://kaotiyun.com/show/Zotp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有下列程序:inta=4:intf(intn)main(){intt=0;staticinta=5;{ints=a,i=0;if(n%2){in
有以下程序main(){inta=3;do{printf("%d,",a-=2);}while(!(--a));printf("\n");}程序运行后的输出结果是
有以下程序voidfunl(char*p){char*q;q=p;while(*q!=’\0’){(*q)++;q++;}}main(){chara[]=11Program
有两个关系R和S如下:则由关系R得到关系S的操作是()。
以下选项中,值为1的表达式是
若有定义intx,y;并已正确给变量赋值,则以下选项中与表达式(x—y)?(x++):(y++)中的条件表达式(x—y)等价的是
在C语言中,函数返回值的类型最终取决于
设循环队列的存储空间为Q(1:m),初始状态为front=rear=m。经过一系列正常的操作后,front=1,rear=m。为了在该队列中寻找值最大的元素,在最坏情况下需要的比较次数为
设顺序表的长度为40,对该表进行冒泡排序。在最坏情况下需要的比较次数为
随机试题
0
Lastweekhepromisedthathe______today,buthehasn’tarrivedyet.
A.阿普唑仑B.环丙沙星C.妥布霉素D.利巴韦林E.阿奇霉素属喹诺酮类的药物是
FIDIC合同条件下,当( )生效之后,承包商根据合同进行索赔的权力就终止了。
A、 B、 C、 D、 A每个黑色的小图形等于两个白色的小图形,经过换算后,第一行每个图形都有7个白色三角形,第二行每个图形都有9个白色正方形,第三行每个图形都有8个白色圆圈,选项中只有A符合。
把下面的六个图形分为两类,使每一类图形都有各自的共同特征或规律,分类正确的一项是:
马克思指出:“商品价格对商品价值的不断背离是一个必要的条件,只有在这个条件下并由于在这个条件下,商品价值才能存在。”这段话说明()
设ξ1=的一个特征向量.(Ⅰ)求常数a,b的值及ξ1所对应的特征值;(Ⅱ)矩阵A可否相似对角化?若A可对角化,对A进行相似对角化;若A不可对角化,说明理由.
Lookattheadvertisementbelow.Itshowsservicesofferedbyabusinessconsultancy.Forquestions6-10,decidewhich(A-H)would
Inthesecondhalfofeachyear,manypowerfulstormsareborninthetropicalAtlanticandCaribbeanseas.Of【C1】______,onlya
最新回复
(
0
)