Can we assign default value to first parameter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can we assign default value to first parameter

16th Apr 2017, 9:48 AM
Tanmay Shimpi
Tanmay Shimpi - avatar
2 Answers
+ 2
yes
16th Apr 2017, 10:13 AM
Tanmay Shimpi
Tanmay Shimpi - avatar
0
You assign a default value in the function header, this is how it looks void example(int a = 1) If you have more than one parameter, then the default value needs to be the last parameter
16th Apr 2017, 10:17 AM
Nicole Benadè
Nicole Benadè - avatar