C++函数的默认参数

int func(int a, int b = 3)
{
   return a + b;
}

int main()
{
   int c = func(2);

   cout << "c: " << c << endl;                                                               

   return 0;
}
c: 5
posted @ 2022-03-06 21:32  thomas_blog  阅读(28)  评论(0)    收藏  举报