1. 程式人生 > >3.函數參數默認值

3.函數參數默認值

turn div urn clas out col cst clu ()

 //默認參數要指定放在右邊
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 }

3.函數參數默認值