Put the default parameter in the forward declaration:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
void val(int, int = 20); int main() { int value = 10; val(value); return 0; } void val(int nval, int val2) { std::cout << nval << "\n"; std::cout << val2 << "\n"; } |