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
Post a Comment