File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
C / C++
operators in c
Joined: May 16, 2013
Aug 31, 2013 04:54:56
it is giving me output as 120,as multiplication has higher priority than addition so i think output should be 102,can sonebody please explain me why i m getting output as 120,thanks
Joined: Apr 06, 2010
Aug 31, 2013 05:59:29
Multiplication has higher precedence than addition. But addition has higher precedence than assignment, and *= is considered an assignment operator.
Joined: Sep 02, 2013
Sep 08, 2013 09:56:00
The combined operators, like += and *=, can always be thought of as treating their right hand operator as a grouped expression. That is, "a *= 10 + 2" is equivalent to "a = a * ( 10 + 2 )", and is not equivalent to "a = a * 10 + 2".
Joined: Oct 18, 2013
Oct 24, 2013 11:52:41
the point is that you should not forget about associative here(association > precedence (
) ) . X= has right to left association .
I agree. Here's the link:
subject: operators in c
Dave Allen's notes is great
variable declaration changes output
Protected variables ONLY viewable to sub classes
Hibernate Query taking long time
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014