C++ difference between [ ] and ( ) when declaring an array -


can tell me difference between these 2 lines of c++ code?

int *p = new int (7); 

and

int *p = new int [7]; 

i can't spot difference except in first 1 put number 7 in p[0] , there other difference? , in case when there char instead of int happen?

thanks in advance.

one array of 7 items

new int [7] 

the other initialising pointer int value of 7


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -