Google Login
Questions
Unanswered
Tags
Users
Ask a Question
Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!
All categories
CSC 211
(579)
CSC 211 (F17)
(70)
CSC 211 (F16)
(185)
(Winter 15-16)
(184)
(Winter 14)
(140)
CSC 285
(231)
CSC 320
(1)
CSC 330
(0)
CSC 370
(0)
CSC 490
(123)
other
(5)
What does x *= x mean?
+7
votes
asked
Oct 6, 2016
in
CSC 211 (F16)
by
Alyssa Nestor
(
100
points)
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
2 Answers
+7
votes
It's basically "x = x * x;"
Just remember that the *= expression is to multiply the number on the left with the number on the right. The same goes with /= += -=.
answered
Oct 6, 2016
by
Minh Ta
(
1,045
points)
Please
log in
or
register
to add a comment.
+3
votes
When you have that format: <variable><operation><equals><value>, you perform the operation applied to the two sides and store that value in the left hand side. In other words, x *= x is equivalent to x = x * x. You can also do this with +=, -=, *=, /=, and %= (and others). These are called compound assignment operators.
http://java.about.com/od/c/g/compoundassgnment.htm
has some more information.
answered
Oct 6, 2016
by
Vecna
(
1,043
points)
Please
log in
or
register
to add a comment.
...