码:
#include <iostream>
using namespace std;
int f(int x = 0) {
cout << "x:" << x << endl;
return 0;
}
int main() {
f();
int f(int x = 1);
f();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出(在g ++ 5.1上测试):
x:0
x:1
Run Code Online (Sandbox Code Playgroud)
我的问题:
int f(int x = 1);宣言还是定义?| 归档时间: |
|
| 查看次数: |
154 次 |
| 最近记录: |