Hello, welcome to the 33rd tutorial in the c++ programming series, and in this part we'll be looking at function parameter default values for values can be provided for functions, and then that particular argument to be emitted. If you do provide default values, only arguments that have default values have to be on the right. We'll show you what we mean in a second. And the reason for this is otherwise the compiler won't know which one when you actually call it. Whenever you specify a value for a variable that actually don't have a default value, or it doesn't, let's just show you what we mean. Let's create a function.
We're gonna say void rain when function In here and passing two numbers in a big, make that equal to five and this is how you default values, you put the equals operator and then you will provide it as simple as that. So if print function is currently passing two numbers, maybe four and five i o before another example, free into a will be free, B will be two. Whereas if you only pass in one parameter, a will be whatever you passed in, and B by default will be five so you can have default value as well. So sore like defaults. I said sorry. So like base values.
So in here, we're simply just going to do STD colon, colon c out. We're going to see a colon B. do best in doing and in line semi-colon. Mr. The operator there, there isn't as simple as corn this function the print function and see as you can see it clearly called one parameter. By default the IntelliSense in Xcode has just detected one parameter free to have by other net to have a necessity. So we're going to put a value of free when according again, get the coin function, and then we'll assign a value for not five one annoying.
Notice when you open up the debug area, so we got free, and it printed out five because we didn't pass in a value for B, but it printed out one and nine for the next print functions. And this is simply because we pass in a value for A and B so the default value more than two, three That's it for this tutorial if you have any questions feel free to message us as well as sonar system coda UK. The email will be in the description comment on this video this direct messages why YouTube, you can also get all recoiling for source code in the description. In the next part we'll be looking at overloaded functions and as usual, thanks for watching and I hope you have a nice day.