带默认值的参数

单选题 难度 2

#function

少传一个参数会怎样?

题目

下面代码的输出是( )。

int add(int a, int b = 10) { return a + b; }
// main: cout << add(3) << " " << add(3, 4) << endl;
  1. 13 7
  2. 3 7
  3. 13 13
  4. 7 7
来小码星球,动手写一遍 →