lundi 26 juin 2017

What does this line of code mean

There is lots of changes in C++ 11 and afterwards. And I just came across this line of code, I thought I created an empty array which defaults to zero and I just added an element in the beginning of the array which is 99. But it prints 42. I am really confused.

int a1 []{};
a1[0] = 99;
cout<<"a1 is " << a1[0];

Console:

a1 is 42

Aucun commentaire:

Enregistrer un commentaire