Hello, welcome to the 16th tutorial in the c++ programming series, and in this problem, we look at the comma operator, the comma operator can be used to separate two more expression which are included, where a single expression is expected all the expressions or only the rightmost expression if you for less give you a simple example so you can see what we mean by the right most but I'm just generally if you can see how it works. This is actually something that I really never use, honestly, personally, to be honest, but it's, it's a feature. So, best if you know it. So let's create a variable int a was b equals seven. Then I'm going to do a equals bracket bracket inside here when do the equals free then to be closed To STD C, print a STD and nine. Okay, so let's just run through this code.
So we create a variable called a grid a variable could be and we assign the value seven to eight and then to a we assign b equals three, so B no long 73. And then we do B plus two and it is this expression aka the rightmost expression, which is the one that if you like is assigned to a or whatever you're doing for in this instance, it's assigning something but you could be doing something else. So yeah, so it should be equal three and B plus two so he should be fired from my calculation. It is five so let's just print have been dead and be free clear signs. The value Be free to it and this statement will actually modify be a just add to on to the value of B which is added on to it but B is modified at all. And really that is it for the common phrase.
Obviously, you could do a lot more and again, the only thing to remember really or the main thing to remember if the rightmost expression is the one that is used for where a single statement or expression is expected. That's it for this tutorial. In the next tutorial we're gonna look at the typecasting operator. If you have any questions feel free to message us or support us on our system Cody Kay, the email will be in the description you can comment on this video was directly messages via YouTube, what the requirement for source code as usual will be in the description. And thank you for watching and I hope you have a nice day.