`f(void)` meaning no parameters in C++11 or C?

后端 未结 5 774
忘掉有多难
忘掉有多难 2021-01-07 17:58

In C++11 the following function declaration:

int f(void);

means the same as:

int f();

A pa

5条回答
  •  悲哀的现实
    2021-01-07 18:11

    This comes to C++ from C. In C f() means unknown number and type of parameters. So in C for no parameters there is f( void ).

    In C++ it's redundant: f() and f( void ) mean same thing - a function that has no parameters.

提交回复
热议问题