lundi 5 décembre 2016

Initializing c++ arrays with references to variables and then values

I saw in some source code something like this

for(int i = 0; i < NUM; i++){
   count[i] = new int;
   *count[i] = 0;
}

And was wondering what the point was as opposed to just having:

count[i] = 0;

Aucun commentaire:

Enregistrer un commentaire