What will happen if combine both default argument and pass by refrence in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What will happen if combine both default argument and pass by refrence in c++

17th Apr 2019, 4:57 PM
Abhinand
Abhinand - avatar
2 Answers
+ 2
You cannot reference a value, that would give an error, unless you make it a const reference. So if for example you write: int f(const int &n=0) {...} It works.
17th Apr 2019, 5:20 PM
HonFu
HonFu - avatar
+ 2
Any one please answer
17th Apr 2019, 4:58 PM
Abhinand
Abhinand - avatar