About Pointers To Functions in function declarations

后端 未结 4 1703
后悔当初
后悔当初 2020-12-01 18:02
#include
#include

int fun1()
{
    printf(\"I am fun1.\");
    return 0;
}

int fun2(int fun())
{
    fun();
    return 0;
}

int mai         


        
4条回答
  •  情歌与酒
    2020-12-01 18:35

    int fun2(int (*fun)()) and int fun2(int fun()) are exactly the same. When you declare a function argument from a function type, the compiler uses it as if it were a pointer to the same function type.

提交回复
热议问题