我在做一道ctf题,有一行我看不懂。
int (*fp)(char *)=(int(*)(char *))&puts, i;
谁能解释一下这是什么意思?
最佳答案
fp
是一个指针
(*fp)
一个函数
(*fp)(
接受 1 个 char
类型的参数
(*fp)(char)
并返回一个int
int (*fp)(char)
经过大部分冗余转换后,指针用 puts
的地址初始化。
int (*fp)(char *)=(int(*)(char *))&puts
int (*fp)(char *)=(int(*)(char *))puts // & redundant
int (*fp)(const char *)=puts
对象 i
未初始化。它的类型为 int
int (*fp)(char *)=(int(*)(char *))&puts, i;
关于c - 无法理解指针语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44476055/