鱼C论坛

 找回密码
 立即注册
查看: 518|回复: 4

[已解决]c语言函数调用问题

[复制链接]
发表于 2020-5-24 16:48:59 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
各位大佬,我太久不用c了,有点疑惑
像下面这个调用compare_bt_lefts
不需要加参数调用吗?像这样:compare_bt_lefts(a,b);
是因为都是const吗?
  1. qsort(selected_detections, selected_detections_num, sizeof(*selected_detections), compare_by_lefts);
复制代码

  1. int compare_by_lefts(const void *a_ptr, const void *b_ptr) {
  2.     const detection_with_class* a = (detection_with_class*)a_ptr;
  3.     const detection_with_class* b = (detection_with_class*)b_ptr;
  4.     const float delta = (a->det.bbox.x - a->det.bbox.w/2) - (b->det.bbox.x - b->det.bbox.w/2);
  5.     return delta < 0 ? -1 : delta > 0 ? 1 : 0;
  6. }
复制代码
最佳答案
2020-5-24 16:55:06
这是传了个函数,不是传的函数返回值
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-5-24 16:55:06 | 显示全部楼层    本楼为最佳答案   
这是传了个函数,不是传的函数返回值
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-5-24 16:56:57 | 显示全部楼层
这是函数传值
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-5-24 17:02:06 | 显示全部楼层
楼上正解
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-5-26 16:11:44 | 显示全部楼层
永恒的蓝色梦想 发表于 2020-5-24 16:55
这是传了个函数,不是传的函数返回值

谢谢!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-8 14:22

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表