Ask Question

True or False? In C++, the expression (a + b / c) / 2 is implicitly parenthesized as ((a + b) / c) / 2.

+1
Answers (1)
  1. 23 July, 03:51
    0
    False

    Explanation:

    The two statements are NOT equivalent since the first statement follows the rule of operator precedence in C+ + which assigns highest precendence to values in parenthesis, then division, multiplication, additions and subtraction in that order. In other verify their difference consider this code snippet

    int a = 2;

    int b = 3;

    int c = 5;

    cout ((a + b / c) / 2); / / outputs 1

    cout (((a + b) / c) / 2); / / outputs 0 because a+b is evaluated first
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “True or False? In C++, the expression (a + b / c) / 2 is implicitly parenthesized as ((a + b) / c) / 2. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers