函数指针和函数指针之间的区别 [英] Difference between function pointers and pointer to function
本文介绍了函数指针和函数指针之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
你能解释一下功能指针与功能指针之间的区别吗?
据我所知,函数指针是一个存储函数地址的指针变量,但指向函数的指针 n是一个以函数指针作为参数的函数。 />
如果我错了,请纠正我。
问候,
Joy
Hello Everyone,
can you please explain the difference between function pointers and pointer to function?
As I understand function pointer is a pointer variable that stores address of a function however pointer to a function is a function which takes function pointer as an argument.
Correct me if i am wrong.
Regards,
Joy
推荐答案
它们是同义词 - 函数指针和指向函数的指针描述一个可以保存函数地址的对象。
They're synonymous - "a function pointer" and "a pointer to a function" describe an object that can hold the address of a function.
完全没有。两者都是相同的:两者都是指针,但强打字是避免问题的关键。
在Windows上经常与 GetProcAdress 和LoadLibrary。
采用指针的函数是正常函数。例如:大多数字符串函数都使用指向char数组(也就是字符串)的指针。
Not at all. It is both the same: both are pointers, but strong typing is key to avoid problems.
On Windows often used with GetProcAdress and LoadLibrary.
A function which takes a pointer is a normal function. For example: the most string functions are working with pointers to char arrays (aka strings).
这篇关于函数指针和函数指针之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文