(*(int(*)())a)()是什么意思? [英] what is the meaning of (*(int (*)())a)()?
本文介绍了(*(int(*)())a)()是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是学习C ++的初学者.今天,我看到了类似这样的指针函数
I am the beginner of learning C++. Today, I saw a pointer function like that
(*(int (*)())a)()
我对它的含义以及如何轻松理解它感到困惑.
I was very confused with what the meaning of this and how I can understand it easily.
推荐答案
让我们添加一个typedef,以帮助使它变得前后无误:
Let's add a typedef, to help make heads or tails out of it:
typedef int (*int_func_ptr)();
(*(int_func_ptr)a)();
因此,将 a
强制转换为特定原型的函数指针,将其取消引用(这是多余的),然后调用.
So a
is being cast to a function pointer of a particular prototype, dereferenced (which is redundant), and then called.
这篇关于(*(int(*)())a)()是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文