c++ - What is the difference between "int *a = new int" and "int *a = new int()"? -
this question has answer here:
what difference between following 2 lines ?
int *a = new int; int *a = new int();
int *a = new int;
a
pointing default-initialized object (which uninitialized object in this case i.e value indeterminate per standard).
int *a = new int();
a
pointing value-initialized object (which zero-initialized object in this case i.e value zero per standard).
Comments
Post a Comment