lundi 30 avril 2018

if statement and --variable

I am working toward my C++ exam, and I am doing some past papers. Then I stumbeled over this code understanding task. And I am wondering, why does value change to 4 in this if statement?

int found = 0, value = 5;
if (!found || --value == 0) {
    cout << "danger";
}
cout << "value =" << value << endl;

Aucun commentaire:

Enregistrer un commentaire