mardi 29 août 2017

Is x+++y well-defined behaviour? [duplicate]

This question already has an answer here:

The expression z = x+++y; is parsed as x++ + y because output of my program is :

x : 2
y : 2
z : 3

My code:

#include <iostream>
using namespace std;

int main() 
{
    int x = 1, y = 2, z;
    z = x+++y;
    cout<<"x : "<<x<<endl<<"y : "<<y<<endl<<"z : "<<z<<endl;
    return 0;
}

So, is x+++y well-defined behaviour?

Aucun commentaire:

Enregistrer un commentaire