将函数调用为fun()和乐趣有什么区别? [英] what is the difference between calling a function as fun() and fun?

查看:120
本文介绍了将函数调用为fun()和乐趣有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到了一段代码,如下所示:

qsort(array,10,sizeof(int),sort);



这里再排序也是一个函数。但是我一直觉得任何被调用的函数都应该在函数名后面有(),或者我错过了某些东西。

我只是想知道这将如何工作,以及这些调用函数有什么区别。感谢!

解决方案

qsort(array,10,sizeof(int),sort);

它传递一个指向函数sort的指针,以便函数qsort可以调用这个函数。


I came across a piece of code which is as below

qsort(array, 10, sizeof(int), sort);

Here sort is again a function. But I was always under the impression that any function which is called should have () after the function name or was I missing something.

I just wanted to know how will this work and what are the differences in calling functions like these. Thanks!

解决方案

qsort(array, 10, sizeof(int), sort);

this passes a pointer to the function "sort" so that the function "qsort" can call this function.

这篇关于将函数调用为fun()和乐趣有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆