int() not initializing when used with new[]
I am using Dev-C++ and CodeBlocks. Both of the compilers, don't show
errors when i do sth like this: int *a= new int[n](); But when i go and
check the values of the a array with a for loop, they are not 0, but
strange numbers instead. I have read in many places that according to the
new C++ ISO, when int() is used instead of int it value-initializes to
default (0). What is the problem here?
No comments:
Post a Comment