首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #define f(x) x*x*x main() { int a=3,s,t ; s=f(a+1); t=f((a+1)); printf("%d,%d\n",s,t); } 程序运行后的输出结果是( )。
有以下程序 #include #define f(x) x*x*x main() { int a=3,s,t ; s=f(a+1); t=f((a+1)); printf("%d,%d\n",s,t); } 程序运行后的输出结果是( )。
admin
2019-12-17
24
问题
有以下程序
#include
#define f(x) x*x*x
main()
{
int a=3,s,t ;
s=f(a+1);
t=f((a+1));
printf("%d,%d\n",s,t);
}
程序运行后的输出结果是( )。
选项
A、10,64
B、10,10
C、64,10
D、64,64
答案
A
解析
宏替换只是使用宏名代替一个字符串,是一种机械的置换,所以表达式s=f(a+1)=a+1*a+1*a+1=10,t=f((a+1))=(a+1)*(a+1)*(a+1)=64,答案选A。
转载请注明原文地址:https://kaotiyun.com/show/9zCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
设有定义:charp[]={’1’,’2’,’3’),*q=p;以下不能计算出一个char型数据所占字节数的表达式是
以下错误的定义语句是
若有语句:char*line[5];,以下叙述中正确的是
有以下程序#includeintfun(intx){intp;if(x=0‖x=1)return(3);P=x-fun(x-2);return(p);}main(){printf("%d\n",fun(9));}程序运行后
有以下程序main(){inta[5]={2,4,6,8,10},*p,*k;P=a;k=&p;printf("%d",*(p++));printf("%d\n",*k);}程序运行后的输出结果是
有以下程序,程序运行后的输出结果是#include#definef(x)x*x*xmain(){inta=3,S,t;s=f(a+1);t=f((a+1));printf("%d,%d\n",s,t);}
以下叙述中正确的是
以下程序段中,与其他3个功能不同的程序段是()。
程序定义了N×N的二维数组,并在主函数中自动赋值。请编写函数fun(inta[][N],intn),该函数的功能是:使数组左下半三角元素中的值乘以n。例如,若n的值为3,a数组中的值为:则返回主程序后a数组中的值应为:注意:部分源程序给出如下。
给定程序MODI1.C中函数fun的功能是:用选择法对数组中的13个元素按从小到大的顺序进行排序。请修改程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行和删行,也不得更改程序的结构!#inolude#defi
随机试题
金属切削机床应通过设计尽可能排除或减少所有潜在的危险因素,通过设计不能避免或充分限制的危险,应采取必要的安全防护装置。下列关于防止机械危险安全措施的说法中。正确的是()。
患者,男,30岁。急起发热,伴头痛乏力。体查:体温39℃,血压75/60mmHg,球结膜充血,颜面及胸前皮肤潮红,肝于肋下1cm触及,血常规:WBC25×109/L,N0.83,L0.14,PLT61.1×109/L,尿蛋白(+++)。本病例的诊
脾为气血生化之源的理论基础是
苏某为庆祝其喜得贵子,邀请胡某等到酒店聚餐。苏某从顾某处购得一超大海螺,将海螺带到酒店交给厨师时,从中剖得一颗硕大的橙黄色椭圆形珍珠,市值1万元。关于该珍珠的归属,下列哪一项说法是正确的?(2018/回忆/单)
在相同条件下的同一种岩石,重度大,说明()。
用友软件中,关于账套主管的说法正确的是()、
甲公司为某企业集团的一个投资中心,X是甲公司下设的一个利润中心,相关资料如下:资料一:2015年X利润中心的营业收入为120万元。变动成本为72万元,该利润中心副主任可控固定成本为10万元,不可控但应由该利润中心负担的固定成本为8万元。资料二:甲公司2
行政机关提供行政许可申请格式文本可以收费。()
下列与水果有关的说法错误的是:
Agroupofpeopleworkingtogetherforabusiness(生意).Thepeoplemaybewillingtohelpyou.
最新回复
(
0
)