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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -