0
c++
what would be the value of x if x=5+2*2/2%5? I mean only(5+2*2/2%5) will be compiled a/c to BODMAS but what about modular (%) sign? Which order it will take/
1 Answer
+ 2
Here, x=7
% operator has higher priority than all other operators in this expression.
Learn more about operator precedence:
http://www.learncpp.com/cpp-tutorial/31-precedence-and-associativity/