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

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

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