Ambiguous declarations
What is the difference between the following two declarations:
1. int foo(in开发者_开发问答t);
2. int foo(int());
I am not sure if both the declarations are equivalent. What makes (2) different from (1)?
int foo(int); is the declaration of a function taking an integer as an argument and returning an integer as well
int foo(int()); declares a function taking as an argument "a pointer to a function returning int and taking {no arguments[in C++] and unspecified number of arguments[in C]} " and returning an integer.
(2) is equivalent to int foo(int (*pf)()) and int foo(int f())
加载中,请稍侯......
精彩评论