以下代码片段执行后,能在屏幕上输出以下内容的是:

a=3
b=4

选项:

A

int a=3,b=4;

printf("%d,%d",a,b);

B

int a=3,b=4;

printf('a=%d,b=%d',a,b);

C

int a=3,b=4;

printf('a=%f
b=%f',a,b);

D

int a=3,b=4;

printf('a=%d
b=%d',a,b);

答案是B和D。

在选项B中,代码使用了格式化字符串来输出变量a和b的值。输出结果是'a=3,b=4'。

在选项D中,代码使用了格式化字符串来输出变量a和b的值。输出结果是'a=3 b=4',其中\n表示换行。


原文地址: https://www.cveoy.top/t/topic/pkoJ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录