cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
/ before *
/ before *
Mar 20, 2014 at 5:42pm UTC
closed account (
EwCjE3v7
)
I don`t understand why the / would be done before *?
cout << 30 / 3 * 21 % 5 << endl;
Mar 20, 2014 at 5:44pm UTC
Disch
(13742)
* and / have the same level of precedence:
http://en.cppreference.com/w/cpp/language/operator_precedence
When operators have the same precedence, they are executed from left to right.
Mar 20, 2014 at 5:45pm UTC
closed account (
EwCjE3v7
)
Oh that explains a lot, thank you Disch :D
Topic archived. No new replies allowed.