关于返回类型的问题!

jim77 2002-06-17 12:21:47
在《C++ 大学教程》的P234:
int ascending( int a, int b)
{
return b < a;
}
b < a 应该时bool型吧,为什么冠以int呢?
...全文
103 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Lemon-sai 2002-06-17
  • 打赏
  • 举报
回复
在c里是没有bool型的,用0表示false,非0表示true
prototype 2002-06-17
  • 打赏
  • 举报
回复
implicitly conversion from bool to int is used in the statement 'return b < a;'.
false --> 0
true --> 1

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧