下列程序的输出结果是()。 #include main() {iut a=2,b=3,p; p=f(a,b) ; printf("%d",p)
下列程序的输出结果是( )。
#include<stdio.h>
main()
{iut a=2,b=3,p;
p=f(a,b) ;
printf("%d",p);
}
intf(a,b)
{int c;
if(a>b) c=1;
e1Seif(a==b) c=0;
else(3=-1;
return(c) ;
}
A.-1
B.0
C.1
D.2
正确答案:A解析:本题考查if else语句。在intf(a,B)中:第一个if语句,先判断条件,发现a>b条件不成立,则执行与其配对的else语句:第二个if语句,先判断条件,发现a==b条件不成立,则执行与其配对的else语句,c=-1。
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。
