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

后端 未结 5 773
忘掉有多难
忘掉有多难 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:06

    In C++ they both mean the same thing.

    In C f(void) is different from f(), becuse f() means "unspecified parameters" - you can legally pass anything (whether the function at receiving the data is happy about that or not is another matter).

提交回复
热议问题