how do you make a default value for a parameter
Printable View
how do you make a default value for a parameter
here is an example:
Code:void function(int x, int y=0)
{
//whatever in here
//if no value is passed for y, it'll be 0 by default..
}
Thanks:)
I wonder what the default keyword is for then?
If you put your C++ code
in php
tags it highlights the keywords nicely.PHP Code:if then "this is a string"
i knoe only one use of the default keyword:
PHP Code:switch(x)
{
case 1: {}
case 2: {}
default: {}//basically, it does what's in these brackets if none of the cases above are met
}