函数名称前的星号函数是什么? [英] What is the function of an asterisk before a function name?
本文介绍了函数名称前的星号函数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
void *我已经对我在大多数C程序中看到的具有不熟悉函数声明的混淆了。 func_name(void * param){
...
}
*
暗示该功能?我对一个变量类型( *
)的理解是,它创建了一个指向另一个变量的指针,因此它可以跟踪哪个地址在后面的变量存储在记忆。但在这个函数的情况下,我不知道这个 *
星号意味着什么。
解决方案
星号属于返回类型,不属于函数名称,即:
void * func_name(void * param){。 。 。 。 。 }
这意味着函数返回一个void 指针。
>I've been confused with what I see on most C programs that has unfamiliar function declaration for me.
void *func_name(void *param){
...
}
What does *
imply for the function? My understanding about (*
) in a variable type is that it creates a pointer to another variable thus it can be able to track what address at which the latter variable is stored in the memory. But in this case of a function, I don't know what this *
asterisk implies.
解决方案
The asterisk belongs to the return type, and not to the function name, i.e.:
void* func_name(void *param) { . . . . . }
It means that the function returns a void pointer.
这篇关于函数名称前的星号函数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文