Computer scienceProgramming languagesC++Operators and expressions

Increment and decrement operators

Value of x

Report a typo

What will be the value of sum after the below code snippet is executed?

#include <iostream>
using namespace std;

int main() {  
    int x = 5; 
    int sum;
    int y = 5;
    
    x++;
    --y;

    sum = x + y;
    
    cout << sum << endl;

    return 0;
}
Select one option from the list

Create a free account to access the full topic