Original Post
Hi, I am using C++. Let's say I have a global vector full of ints called g_vecInts. If I create a pointer to an int I could use 'new' or not use 'new'. eg //So I could use new, but then I have to use 'delete' to delete it: //I can also not use 'new'. I don't have to remember to use 'delete': Now, is there any reason to use 'new' in my situation? Any advantage? Any disadvantage when not using 'new'? [Edited by - utilae on June 4, 2006 4:57:49 PM]
int *pNewInt=new int;
pNewInt=5;
g_vecInts.push_back(pNewInt);
int *pNewInt;
pNewInt=5;
g_vecInts.push_back(pNewInt);