lundi 3 avril 2017

c++ initializer difference, with and without = operator

What is difference between initializing x1 and x2?

struct X {
    int i;
};

void func(){
    X x1 = {2};
    X x2 {2};

    cout << x1.i << ", " << x2.i << endl;
}

Aucun commentaire:

Enregistrer un commentaire