3.函数参数默认值

 //默认参数要指定放在右边
1
#include <iostream> 2 #include <cstdarg> 3 using namespace std; 4 5 int add(int a,int b,int c = 1) 6 { 7 return a + b + c; 8 } 9 10 void main() 11 { 12 cout << add(1, 2); 13 14 }

 

posted @ 2018-03-11 11:06  喵小喵~  阅读(126)  评论(0编辑  收藏  举报