Comma Operator

2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€83.41
List Price:  €116.78
You save:  €33.37
£72.52
List Price:  £101.53
You save:  £29.01
CA$135.63
List Price:  CA$189.89
You save:  CA$54.25
A$142.79
List Price:  A$199.91
You save:  A$57.12
S$126.05
List Price:  S$176.48
You save:  S$50.42
HK$780.17
List Price:  HK$1,092.27
You save:  HK$312.10
CHF 76.70
List Price:  CHF 107.38
You save:  CHF 30.68
NOK kr961.94
List Price:  NOK kr1,346.75
You save:  NOK kr384.81
DKK kr622.83
List Price:  DKK kr871.99
You save:  DKK kr249.15
NZ$165.78
List Price:  NZ$232.10
You save:  NZ$66.31
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,118.78
List Price:  ৳16,966.78
You save:  ৳4,848
₹9,176.33
List Price:  ₹12,847.23
You save:  ₹3,670.90
RM391.86
List Price:  RM548.62
You save:  RM156.76
₦140,087.98
List Price:  ₦196,128.78
You save:  ₦56,040.80
₨27,766
List Price:  ₨38,873.51
You save:  ₨11,107.51
฿3,105.18
List Price:  ฿4,347.38
You save:  ฿1,242.20
₺4,340.99
List Price:  ₺6,077.57
You save:  ₺1,736.57
B$519.41
List Price:  B$727.20
You save:  B$207.78
R1,590.77
List Price:  R2,227.14
You save:  R636.37
Лв163.15
List Price:  Лв228.41
You save:  Лв65.26
₩142,933.74
List Price:  ₩200,112.96
You save:  ₩57,179.21
₪309.33
List Price:  ₪433.07
You save:  ₪123.74
₱5,871.28
List Price:  ₱8,220.03
You save:  ₱2,348.74
¥15,269.79
List Price:  ¥21,378.31
You save:  ¥6,108.52
MX$1,717.22
List Price:  MX$2,404.18
You save:  MX$686.96
QR360.53
List Price:  QR504.75
You save:  QR144.22
P1,305.25
List Price:  P1,827.41
You save:  P522.15
KSh12,908.70
List Price:  KSh18,072.70
You save:  KSh5,164
E£4,698.69
List Price:  E£6,578.35
You save:  E£1,879.66
ብር15,419.29
List Price:  ብር21,587.62
You save:  ብር6,168.33
Kz91,204.13
List Price:  Kz127,689.44
You save:  Kz36,485.30
CLP$86,198.27
List Price:  CLP$120,681.03
You save:  CLP$34,482.75
CN¥694.50
List Price:  CN¥972.32
You save:  CN¥277.82
RD$6,239.44
List Price:  RD$8,735.47
You save:  RD$2,496.02
DA12,936.14
List Price:  DA18,111.12
You save:  DA5,174.97
FJ$219.71
List Price:  FJ$307.61
You save:  FJ$87.89
Q760.92
List Price:  Q1,065.33
You save:  Q304.40
GY$20,748.59
List Price:  GY$29,048.86
You save:  GY$8,300.26
ISK kr12,110.78
List Price:  ISK kr16,955.58
You save:  ISK kr4,844.80
DH900.62
List Price:  DH1,260.91
You save:  DH360.28
L1,676.84
List Price:  L2,347.65
You save:  L670.80
ден5,141.26
List Price:  ден7,197.97
You save:  ден2,056.71
MOP$796.89
List Price:  MOP$1,115.68
You save:  MOP$318.79
N$1,590.27
List Price:  N$2,226.44
You save:  N$636.17
C$3,649.41
List Price:  C$5,109.32
You save:  C$1,459.91
रु14,554.07
List Price:  रु20,376.28
You save:  रु5,822.21
S/332.39
List Price:  S/465.36
You save:  S/132.97
K424.30
List Price:  K594.04
You save:  K169.73
SAR374.97
List Price:  SAR524.97
You save:  SAR150
ZK1,958.12
List Price:  ZK2,741.45
You save:  ZK783.32
L425.04
List Price:  L595.08
You save:  L170.03
Kč2,024.30
List Price:  Kč2,834.10
You save:  Kč809.80
Ft31,712.73
List Price:  Ft44,399.09
You save:  Ft12,686.36
SEK kr881.19
List Price:  SEK kr1,233.71
You save:  SEK kr352.51
ARS$144,261.78
List Price:  ARS$201,972.26
You save:  ARS$57,710.48
Bs685.31
List Price:  Bs959.46
You save:  Bs274.15
COP$366,203.93
List Price:  COP$512,700.15
You save:  COP$146,496.22
₡49,271.94
List Price:  ₡68,982.69
You save:  ₡19,710.74
L2,617.16
List Price:  L3,664.13
You save:  L1,046.97
₲664,714.96
List Price:  ₲930,627.54
You save:  ₲265,912.57
$U3,743.56
List Price:  $U5,241.13
You save:  $U1,497.57
zł350.38
List Price:  zł490.55
You save:  zł140.16
Already have an account? Log In

Transcript

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.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.