the difference between new[] & new?
whats the difference between usig the new[] operator and the new operator???
~prevail by daring to fail~
with the ''new'' operator, you allocate memory and get a pointer to it:
int* i = new int;
now, if you want to allocate an array of 100 int''s:
int* iv = new int [100];
(the size you allocate must be a constant/const variable)
..and make sure that you delete the second one like this:
delete [] iv; //delete the whole block
int* i = new int;
now, if you want to allocate an array of 100 int''s:
int* iv = new int [100];
(the size you allocate must be a constant/const variable)
..and make sure that you delete the second one like this:
delete [] iv; //delete the whole block
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement