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
€84.92
List Price:  €118.90
You save:  €33.97
£74.06
List Price:  £103.69
You save:  £29.62
CA$136.81
List Price:  CA$191.54
You save:  CA$54.73
A$148.86
List Price:  A$208.41
You save:  A$59.55
S$128.39
List Price:  S$179.76
You save:  S$51.36
HK$777.09
List Price:  HK$1,087.96
You save:  HK$310.87
CHF 78.91
List Price:  CHF 110.47
You save:  CHF 31.56
NOK kr1,000.83
List Price:  NOK kr1,401.21
You save:  NOK kr400.37
DKK kr634.47
List Price:  DKK kr888.29
You save:  DKK kr253.81
NZ$171.30
List Price:  NZ$239.83
You save:  NZ$68.52
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,220.44
List Price:  ৳17,109.11
You save:  ৳4,888.66
₹8,977.71
List Price:  ₹12,569.16
You save:  ₹3,591.44
RM404.80
List Price:  RM566.74
You save:  RM161.94
₦145,094.48
List Price:  ₦203,138.08
You save:  ₦58,043.60
₨28,013.30
List Price:  ₨39,219.75
You save:  ₨11,206.44
฿3,107.58
List Price:  ฿4,350.74
You save:  ฿1,243.15
₺4,283.32
List Price:  ₺5,996.82
You save:  ₺1,713.49
B$554.37
List Price:  B$776.14
You save:  B$221.77
R1,666.63
List Price:  R2,333.35
You save:  R666.72
Лв166.02
List Price:  Лв232.43
You save:  Лв66.41
₩144,218.57
List Price:  ₩201,911.77
You save:  ₩57,693.20
₪319.22
List Price:  ₪446.92
You save:  ₪127.70
₱5,870.26
List Price:  ₱8,218.60
You save:  ₱2,348.33
¥15,655.93
List Price:  ¥21,918.93
You save:  ¥6,263
MX$1,790.90
List Price:  MX$2,507.33
You save:  MX$716.43
QR364.51
List Price:  QR510.32
You save:  QR145.81
P1,314.55
List Price:  P1,840.43
You save:  P525.87
KSh12,893.71
List Price:  KSh18,051.71
You save:  KSh5,158
E£4,754.90
List Price:  E£6,657.05
You save:  E£1,902.15
ብር15,558.93
List Price:  ብር21,783.13
You save:  ብር6,224.19
Kz91,219.48
List Price:  Kz127,710.93
You save:  Kz36,491.44
CLP$90,580.94
List Price:  CLP$126,816.94
You save:  CLP$36,236
CN¥700.59
List Price:  CN¥980.86
You save:  CN¥280.26
RD$6,268.37
List Price:  RD$8,775.97
You save:  RD$2,507.60
DA12,969.49
List Price:  DA18,157.81
You save:  DA5,188.31
FJ$226.89
List Price:  FJ$317.66
You save:  FJ$90.76
Q766.16
List Price:  Q1,072.65
You save:  Q306.49
GY$20,921.62
List Price:  GY$29,291.11
You save:  GY$8,369.48
ISK kr12,571.74
List Price:  ISK kr17,600.94
You save:  ISK kr5,029.20
DH912.39
List Price:  DH1,277.39
You save:  DH364.99
L1,677.58
List Price:  L2,348.67
You save:  L671.09
ден5,227.78
List Price:  ден7,319.11
You save:  ден2,091.32
MOP$801.02
List Price:  MOP$1,121.47
You save:  MOP$320.44
N$1,664.35
List Price:  N$2,330.15
You save:  N$665.80
C$3,680.29
List Price:  C$5,152.56
You save:  C$1,472.26
रु14,368.75
List Price:  रु20,116.83
You save:  रु5,748.07
S/336.50
List Price:  S/471.12
You save:  S/134.61
K431.86
List Price:  K604.62
You save:  K172.76
SAR375.20
List Price:  SAR525.30
You save:  SAR150.09
ZK2,257.52
List Price:  ZK3,160.62
You save:  ZK903.09
L432.46
List Price:  L605.47
You save:  L173
Kč2,058.75
List Price:  Kč2,882.33
You save:  Kč823.58
Ft32,856.71
List Price:  Ft46,000.71
You save:  Ft13,144
SEK kr915.69
List Price:  SEK kr1,282.01
You save:  SEK kr366.31
ARS$145,090.96
List Price:  ARS$203,133.16
You save:  ARS$58,042.19
Bs692.55
List Price:  Bs969.60
You save:  Bs277.04
COP$376,785.69
List Price:  COP$527,515.04
You save:  COP$150,729.35
₡49,946.85
List Price:  ₡69,927.60
You save:  ₡19,980.74
L2,635.99
List Price:  L3,690.49
You save:  L1,054.50
₲677,713.63
List Price:  ₲948,826.20
You save:  ₲271,112.56
$U3,919.50
List Price:  $U5,487.46
You save:  $U1,567.95
zł357.96
List Price:  zł501.17
You save:  zł143.20
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.