티스토리 뷰

Series

Argument Parameter [C++] Default Arguments

More Code 2018. 6. 24. 18:46


// C++ : Default Arguments

#include <iostream>
#include <cstdlib>

using namespace std;

int sum(int x, int y = 3); // Default Arguments

int main(int argc, char *argv[])
{
cout << sum(2) << endl;
return EXIT_SUCCESS;
}

int sum(int x, int y)
{
return x + y;
}

/* Output
5
*/


'Series' 카테고리의 다른 글

Argument Parameter [C#] Named Arguments  (0) 2018.06.24
Argument Parameter [Python] Default Argument Values  (0) 2018.06.24
Argument Parameter [C#] Optional Arguments  (0) 2018.06.24
for [C/C++] int  (0) 2018.06.21
for [Java] int  (0) 2018.06.20
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함